Forum: Ruby-core [ruby-trunk - Bug #7951][Open] Cannot rescue SignalException in 1.9.3 or 2.0.0

Posted by jamesotron (James Harton) (Guest)
on 2013-02-25 03:02
(Received via mailing list)
Issue #7951 has been reported by jamesotron (James Harton).

----------------------------------------
Bug #7951: Cannot rescue SignalException in 1.9.3 or 2.0.0
https://bugs.ruby-lang.org/issues/7951

Author: jamesotron (James Harton)
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


When running the example provided on 
http://www.ruby-doc.org/core-1.9.3/SignalException.html we find that 
neither Ruby 1.9.3p392 nor Ruby 2.0.0p0 are able to rescue 
SignalException:

$ cat <<EOF >signal_exception_test.rb
puts "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
begin
  Process.kill('HUP',Process.pid)
rescue SignalException => e
  puts "received Exception #{e}"
end
EOF

$ rvm 1.8.7,1.9.3,2.0.0 do ruby signal_exception_test.rb
1.8.7p371
received Exception SIGHUP
1.9.3p392
/Users/jnh/.rvm/scripts/set: line 20: 99759 Hangup: 1 
"${args[@]}"
2.0.0p0
/Users/jnh/.rvm/scripts/set: line 20: 99816 Hangup: 1 
"${args[@]}"
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-25 19:41
(Received via mailing list)
Issue #7951 has been updated by kosaki (Motohiro KOSAKI).


Following modified script works fine. That is a issue of YARV signal 
handling.

puts "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
begin
  Process.kill('HUP',Process.pid)
  sleep 0.1
rescue SignalException => e
  puts "received Exception #{e}"
end


----------------------------------------
Bug #7951: Cannot rescue SignalException in 1.9.3 or 2.0.0
https://bugs.ruby-lang.org/issues/7951#change-37000

Author: jamesotron (James Harton)
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


When running the example provided on 
http://www.ruby-doc.org/core-1.9.3/SignalException.html we find that 
neither Ruby 1.9.3p392 nor Ruby 2.0.0p0 are able to rescue 
SignalException:

$ cat <<EOF >signal_exception_test.rb
puts "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
begin
  Process.kill('HUP',Process.pid)
rescue SignalException => e
  puts "received Exception #{e}"
end
EOF

$ rvm 1.8.7,1.9.3,2.0.0 do ruby signal_exception_test.rb
1.8.7p371
received Exception SIGHUP
1.9.3p392
/Users/jnh/.rvm/scripts/set: line 20: 99759 Hangup: 1 
"${args[@]}"
2.0.0p0
/Users/jnh/.rvm/scripts/set: line 20: 99816 Hangup: 1 
"${args[@]}"
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-25 19:47
(Received via mailing list)
Issue #7951 has been updated by kosaki (Motohiro KOSAKI).


I changed a doc because the example has a mistake of usage of 
Process.kill(). Process.kill() doesn't have any guarantee when signal 
will be delivered.
----------------------------------------
Bug #7951: Cannot rescue SignalException in 1.9.3 or 2.0.0
https://bugs.ruby-lang.org/issues/7951#change-37002

Author: jamesotron (James Harton)
Status: Closed
Priority: Normal
Assignee:
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


When running the example provided on 
http://www.ruby-doc.org/core-1.9.3/SignalException.html we find that 
neither Ruby 1.9.3p392 nor Ruby 2.0.0p0 are able to rescue 
SignalException:

$ cat <<EOF >signal_exception_test.rb
puts "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
begin
  Process.kill('HUP',Process.pid)
rescue SignalException => e
  puts "received Exception #{e}"
end
EOF

$ rvm 1.8.7,1.9.3,2.0.0 do ruby signal_exception_test.rb
1.8.7p371
received Exception SIGHUP
1.9.3p392
/Users/jnh/.rvm/scripts/set: line 20: 99759 Hangup: 1 
"${args[@]}"
2.0.0p0
/Users/jnh/.rvm/scripts/set: line 20: 99816 Hangup: 1 
"${args[@]}"
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.