Bug #3213: ConditionVariable#wait in main thread silently returns when a signal is received
http://redmine.ruby-lang.org/issues/show/3213

Author: Sylvain Joyeux
Status: Open, Priority: High
Category: core
ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]

The signal handling implementation unconditionally sets the main thread state to RUNNING and interrupts it (thread.c: 2574). In practice, it means that if the main thread waits for a condition variable, it will resume its execution even though the variable has never been signaled.

(moreover, because of #3212, the CV becomes inconsistent and the thread will get interrupted next time the CV is signalled, even though it is *not* waiting for the CV).

IMO, a proper signal handling structure would be to wake up the thread only in interruption cases (i.e. when an exception such as Interrupt needs to be raised), but not when a trap is executed.

Though, I do think that condition variables should *not* silently be released when a signal is received. Worst case, an exception should be raised.

I set the priority to high as this bugs makes condition variables unreliable in practice


----------------------------------------
http://redmine.ruby-lang.org