Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Rubinius terminates actions on SIGINT, regardless of signal handler #2093

Closed
Quintus opened this Issue Dec 9, 2012 · 0 comments

Comments

Projects
None yet
2 participants

Quintus commented Dec 9, 2012

Hi there,

Rubinius shows a strange behaviour when registering a signal handler via #trap. In the following code:

trap "SIGINT" do
  puts "Cought SIGINT!"
end

sleep 10
puts "After sleep"

Rubinius will terminate the #sleep immediately when it receives a Ctrl-C. In the following demo run I pressed Ctrl-C after about two seconds:

% ruby foo.rb    
^CCought SIGINT!
After sleep

MRI shows the expected behaviour of letting #sleep continue:

(1026) [21:24:19 quintus@hades] /tmp
% use mri
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
(1027) [21:25:36 quintus@hades] /tmp
% ruby foo.rb 
^CCought SIGINT!
^CCought SIGINT!
^CCought SIGINT!
After sleep

The behaviour is similar with Thread joins:

trap "SIGINT" do
  puts "Cought SIGINT!"
end

t = Thread.new{sleep}
t.join(10)

puts "After sleep"

Probably the behaviour is similar with non-sleeping expressions, but I can’t think of an atomic long-running expression at the moment to test it...

Rubinius version is from today’s master: rubinius 2.0.0rc1 (1.9.3 146bdc00 2012-11-02 JI) [x86_64-unknown-linux-gnu]

OS is Arch Linux 64 bits.

Valete,
Marvin

@dbussink dbussink closed this in 761cafc Feb 5, 2013

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