Project

General

Profile

Feature #15002

[PATCH] thread.c (sleep_*): reduce the effect of spurious interrupts

Added by normalperson (Eric Wong) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:88510]

Description

Spurious interrupts from SIGCHLD cause Mutex#sleep (via
ConditionVariable#wait) to return early and breaks some use
cases.  Since these are outside the programs's control with
MJIT, we will only consider pending interrupts (e.g. those
from Thread#run) and signals which cause a Ruby-level Signal.trap
handler to fire as "spurious" wakeups.

This fixes all the Net::IMAP tests in test-all for me with --jit-wait

Remaining test-all failures with --jit-wait after this patch:

>   1) Failure:
> TestThreadQueue#test_queue_close_multi_multi [/ruby/test/ruby/test_thread_queue.rb:526]:
> no threads running

Seems like the test is too timing-sensitive for producer thread lifetime.

>   2) Failure:
> TestIO#test_recycled_fd_close [/ruby/test/ruby/test_io.rb:3804]:
> Expected /stream closed/ to match "closed stream".

Not sure if solvable with MJIT, the difference is minor and won't
affect real-world tests.  We should probably loosen the test to allow
either "stream closed" or "closed stream"

>   3) Failure:
> TestRubyOptimization#test_tailcall_condition_block [/ruby/test/ruby/test_optimization.rb:439]:
> [ruby-core:78015] [Bug #12905]: 10079 / 20158 stack levels.
> Exception raised:
> <#<SystemStackError: stack level too deep>>.

Haven't investigated (I think k0kubun would know better)


Files

Also available in: Atom PDF