Signals not handled when main thread executes join #2835

southerngs opened this Issue Dec 17, 2013 · 2 comments


None yet

3 participants


I noticed that when creating multiple threads that Rubinius was not terminating my script when i pressed ctrl-c. The following is a simple script that demonstrates the problem:

Signal.trap("SIGINT") do
  puts "Caught SIGINT"

def func 
  while true do
    puts "Thread running"

t ={ func() }

When running this script with MRI, typing ctlr-c causes the program to exit with the message Caught SIGINT. But when run with Rubinius the script ignores ctrl-c and the rbx process has to be killed to terminate the program. Note that the signal handler and the printing are not necessary, I only added them to check why the process seemed hung. The following also has the same problem:

t ={ while true do sleep(0.1) end }

And the problem is related to join because the following correctly catches and terminates the script when ctrl-c is typed:

t ={ while true do sleep(0.1) end }
while true do sleep(0.1) end

I tested when building from head on the master branch while running with Ubuntu 12.04.


I can confirm that this issue persists in the current master branch. This is probably caused by Thread#join blocking the main thread, preventing it from receiving/handling signals. An option might be to run trapped signals in their own thread but we'll have to investigate what option is best.


+1 Kinda annoying when want to quickly terminate a stuck process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment