diff options
author | Takashi Kokubun <[email protected]> | 2024-05-29 11:46:33 -0700 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2024-05-29 11:46:33 -0700 |
commit | 6e46a363a8f29d93cf6992805ee67d029cea030f (patch) | |
tree | 95f588022126443b2184282eadd5d9320e7a0818 | |
parent | 541fc816fcb697307d666fed644ddd07ca5e942e (diff) |
merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]
Don't clear pending interrupts in the parent process. (#10365)
-rw-r--r-- | process.c | 1 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 21 | ||||
-rw-r--r-- | thread.c | 1 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 23 insertions, 2 deletions
@@ -1682,7 +1682,6 @@ before_fork_ruby(void) static void after_fork_ruby(rb_pid_t pid) { - rb_threadptr_pending_interrupt_clear(GET_THREAD()); if (pid == 0) { // child clear_pid_cache(); diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 188ef75fae..d9804aaa57 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -2783,4 +2783,25 @@ EOS assert_operator(GC.stat(:total_freed_pages), :>, 0) end; end + + def test_handle_interrupt_with_fork + Thread.handle_interrupt(RuntimeError => :never) do + Thread.current.raise(RuntimeError, "Queued error") + + assert_predicate Thread, :pending_interrupt? + + pid = Process.fork do + if Thread.pending_interrupt? + exit 1 + end + end + + _, status = Process.waitpid2(pid) + assert_predicate status, :success? + + assert_predicate Thread, :pending_interrupt? + end + rescue RuntimeError + # Ignore. + end if defined?(fork) end @@ -4701,6 +4701,7 @@ void rb_thread_atfork(void) { rb_thread_t *th = GET_THREAD(); + rb_threadptr_pending_interrupt_clear(th); rb_thread_atfork_internal(th, terminate_atfork_i); th->join_list = NULL; rb_fiber_atfork(th); @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 65 +#define RUBY_PATCHLEVEL 66 #include "ruby/version.h" #include "ruby/internal/abi.h" |