Issue Type: Bug Bug
Affects Versions: JRuby 1.6.7
Assignee: Unassigned
Attachments: thread_test.rb
Components: Ruby 1.8.7
Created: 22/May/12 1:04 PM
Description:

MRI ruby and jruby 1.6.7.2 (1.7.0.dev also tested)

Have very different behavior for the script below.
In short, jruby always allows the contents of a backtick to complete even
if Thread.kill or Thread.raise is called. MRI ruby does not.

Consider the following script:
####################Begin script###################
require 'thread'

begin
t = Thread.current
puts "Good morning – " + Time.now.to_s
Thread.new do
sleep 1
puts "Killing the main thread at " + Time.now.to_s + "!"
t.kill #no kill!!!!!!!!!!!!!!!!
#t.raise "Please stop!"
end
puts "Backtick nap starting"
`sleep 10`
puts "Backtick nap ending (should not see me)"
ensure
puts "Terminated at " + Time.now.to_s
end
##################END script!######################################

MRI's output is, as expected:
Good morning – Tue May 22 13:42:38 -0400 2012
Backtick nap starting
Killing the main thread at Tue May 22 13:42:39 -0400 2012!
Terminated at Tue May 22 13:42:39 -0400 2012

JRUBy's:
Good morning – Tue May 22 13:54:36 -0400 2012
Backtick nap starting
Killing the main thread at Tue May 22 13:54:37 -0400 2012!
Terminated at Tue May 22 13:54:47 -0400 2012

I have read the wiki titled "Jruby Internal design – More on threading"
and I recognize that I might be told that I have to suck it up and deal with it...

Environment: 32 bit windows xp
Project: JRuby
Priority: Major Major
Reporter: Cris Shupp
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to