io-event 1.19.3 → 1.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9b4e34ef8c8e421b9fe40c1e0556a1317b3233f0746f3c8c613c26bc962a2db
4
- data.tar.gz: 8c4839836a933969612713d34031d2a88e8bac969061b64ad1d188db4f56e4db
3
+ metadata.gz: 9d72eba7de108f1051424997dec0f1d83a38a7a4d927089e1ca7ba0478922ef5
4
+ data.tar.gz: 0a423df73be6c4aec9efc892014b867807794989b45500700a5bbca423ff8915
5
5
  SHA512:
6
- metadata.gz: 75d55f360c232dbbb88c9794db98cd3c4e685652f7e407b1f411c2296991a6a31b947f5448e91a44daed431d562859e3f3d45640ecc99ae0936b65edbcb48183
7
- data.tar.gz: 8f47bb334168fc983d765e39c53ccc6a19501204c15ae68d72bbeb3d11f0459b6a255c2ea944061ac494c8696c28d992bb3b241c6685ba3c6aaa2fc8ef5c98a1
6
+ metadata.gz: cc15fd5deeaf2aeb9fcad4d58da2e06daf6e9ec6933020ccc2bfb1ad3705e52f52958b5086e459cc4a85c0a5ee22c16482b7cd9d3a0e0ff254f725df72bcc02e
7
+ data.tar.gz: 7fcab614752bb5db345e31e60a34d52e9b06d1386ac6531b301063ae77a1dd01cc1f5b2beeb5e482a89f4898ca9c85ce4cc56faf4db37219e3fd9c2478266118
checksums.yaml.gz.sig CHANGED
Binary file
@@ -847,6 +847,7 @@ struct select_arguments {
847
847
 
848
848
  int count;
849
849
  int result;
850
+ int error;
850
851
  struct epoll_event events[EPOLL_MAX_EVENTS];
851
852
 
852
853
  struct timespec * timeout;
@@ -868,9 +869,9 @@ static int make_timeout_ms(struct timespec * timeout) {
868
869
  }
869
870
 
870
871
  static
871
- int enosys_error(int result) {
872
+ int enosys_error(int result, int error) {
872
873
  if (result == -1) {
873
- return errno == ENOSYS;
874
+ return error == ENOSYS;
874
875
  }
875
876
 
876
877
  return 0;
@@ -882,12 +883,13 @@ void * select_internal(void *_arguments) {
882
883
 
883
884
  #if defined(HAVE_EPOLL_PWAIT2)
884
885
  arguments->result = epoll_pwait2(arguments->selector->descriptor, arguments->events, arguments->count, arguments->timeout, NULL);
886
+ arguments->error = errno;
885
887
 
886
888
  // Comment out the above line and enable the below lines to test ENOSYS code path.
887
889
  // arguments->result = -1;
888
- // errno = ENOSYS;
890
+ // arguments->error = ENOSYS;
889
891
 
890
- if (!enosys_error(arguments->result)) {
892
+ if (!enosys_error(arguments->result, arguments->error)) {
891
893
  return NULL;
892
894
  }
893
895
  else {
@@ -896,6 +898,7 @@ void * select_internal(void *_arguments) {
896
898
  #endif
897
899
 
898
900
  arguments->result = epoll_wait(arguments->selector->descriptor, arguments->events, arguments->count, make_timeout_ms(arguments->timeout));
901
+ arguments->error = errno;
899
902
 
900
903
  return NULL;
901
904
  }
@@ -903,12 +906,12 @@ void * select_internal(void *_arguments) {
903
906
  static
904
907
  int select_internal_without_gvl(struct select_arguments *arguments) {
905
908
  arguments->result = -1;
909
+ arguments->error = EINTR;
906
910
  IO_Event_Selector_blocking_operation(&arguments->selector->backend, select_internal, (void *)arguments, RUBY_UBF_IO, 0);
907
911
 
908
912
  if (arguments->result == -1) {
909
- // If Ruby skips the native callback, the result sentinel can remain `-1`; `errno` may be `0` or `EINTR` depending on the Ruby implementation. Both cases mean the blocking wait did not produce any events.
910
- if (errno != EINTR && errno != 0) {
911
- rb_sys_fail("select_internal_without_gvl:epoll_wait");
913
+ if (arguments->error != EINTR) {
914
+ rb_syserr_fail(arguments->error, "select_internal_without_gvl:epoll_wait");
912
915
  } else {
913
916
  return 0;
914
917
  }
@@ -922,8 +925,8 @@ int select_internal_with_gvl(struct select_arguments *arguments) {
922
925
  select_internal((void *)arguments);
923
926
 
924
927
  if (arguments->result == -1) {
925
- if (errno != EINTR) {
926
- rb_sys_fail("select_internal_with_gvl:epoll_wait");
928
+ if (arguments->error != EINTR) {
929
+ rb_syserr_fail(arguments->error, "select_internal_with_gvl:epoll_wait");
927
930
  } else {
928
931
  return 0;
929
932
  }
@@ -851,6 +851,7 @@ struct select_arguments {
851
851
 
852
852
  int count;
853
853
  int result;
854
+ int error;
854
855
  struct kevent events[KQUEUE_MAX_EVENTS];
855
856
 
856
857
  struct timespec storage;
@@ -864,6 +865,7 @@ void * select_internal(void *_arguments) {
864
865
  struct select_arguments * arguments = (struct select_arguments *)_arguments;
865
866
 
866
867
  arguments->result = kevent(arguments->selector->descriptor, NULL, 0, arguments->events, arguments->count, arguments->timeout);
868
+ arguments->error = errno;
867
869
 
868
870
  return NULL;
869
871
  }
@@ -871,12 +873,12 @@ void * select_internal(void *_arguments) {
871
873
  static
872
874
  int select_internal_without_gvl(struct select_arguments *arguments) {
873
875
  arguments->result = -1;
876
+ arguments->error = EINTR;
874
877
  IO_Event_Selector_blocking_operation(&arguments->selector->backend, select_internal, (void *)arguments, RUBY_UBF_IO, 0);
875
878
 
876
879
  if (arguments->result == -1) {
877
- // If Ruby skips the native callback, the result sentinel can remain `-1`; `errno` may be `0` or `EINTR` depending on the Ruby implementation. Both cases mean the blocking wait did not produce any events.
878
- if (errno != EINTR && errno != 0) {
879
- rb_sys_fail("select_internal_without_gvl:kevent");
880
+ if (arguments->error != EINTR) {
881
+ rb_syserr_fail(arguments->error, "select_internal_without_gvl:kevent");
880
882
  } else {
881
883
  return 0;
882
884
  }
@@ -890,8 +892,8 @@ int select_internal_with_gvl(struct select_arguments *arguments) {
890
892
  select_internal((void *)arguments);
891
893
 
892
894
  if (arguments->result == -1) {
893
- if (errno != EINTR) {
894
- rb_sys_fail("select_internal_with_gvl:kevent");
895
+ if (arguments->error != EINTR) {
896
+ rb_syserr_fail(arguments->error, "select_internal_with_gvl:kevent");
895
897
  } else {
896
898
  return 0;
897
899
  }
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Event
10
- VERSION = "1.19.3"
10
+ VERSION = "1.19.4"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -18,6 +18,10 @@ Please see the [project documentation](https://socketry.github.io/io-event/) for
18
18
 
19
19
  Please see the [project releases](https://socketry.github.io/io-event/releases/index) for all releases.
20
20
 
21
+ ### v1.19.4
22
+
23
+ - Capture `errno` immediately after `epoll_wait` / `kevent`, preventing stale or subsequently clobbered values from raising a spurious `Errno::*` when a native selector wait is interrupted or skipped.
24
+
21
25
  ### v1.19.3
22
26
 
23
27
  - Prevent `URing`, `EPoll`, and `KQueue` from entering a native wait when a signal exception becomes pending during the GVL transition. On Ruby versions without `RB_NOGVL_PENDING_INTR_FAIL`, the fallback now refreshes pending-interrupt state immediately before releasing the GVL while preserving the caller's exception-delivery timing.
@@ -55,10 +59,6 @@ Please see the [project releases](https://socketry.github.io/io-event/releases/i
55
59
 
56
60
  - Improve timer heap performance by batching scheduled timer insertion, compacting cancelled timers during flush, and avoiding unnecessary heap rebuilds for small incremental inserts.
57
61
 
58
- ### v1.16.1
59
-
60
- - Ensure the pure Ruby `Select` selector returns `false`, not `nil`, when `io_wait` resumes without any ready events.
61
-
62
62
  ## Contributing
63
63
 
64
64
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v1.19.4
4
+
5
+ - Capture `errno` immediately after `epoll_wait` / `kevent`, preventing stale or subsequently clobbered values from raising a spurious `Errno::*` when a native selector wait is interrupted or skipped.
6
+
3
7
  ## v1.19.3
4
8
 
5
9
  - Prevent `URing`, `EPoll`, and `KQueue` from entering a native wait when a signal exception becomes pending during the GVL transition. On Ruby versions without `RB_NOGVL_PENDING_INTR_FAIL`, the fallback now refreshes pending-interrupt state immediately before releasing the GVL while preserving the caller's exception-delivery timing.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.3
4
+ version: 1.19.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file