Project

General

Profile

Actions

Bug #7459

closed

at_exit { Thread.new {} } broken in r37921

Added by zenspider (Ryan Davis) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
2.0
Backport:
[ruby-core:50276]

Description

ruby -e 'p Thread.current; at_exit { p Thread.current; [Thread.new {}].map(&:join) }'

outputs:

#<Thread:0x007feeb28b0fa8 run>
#<Thread:0x007feeb28b0fa8 dead>
-e:1:in new': can't alloc thread (ThreadError) from -e:1:in block in '

Either the main thread shouldn't be marked as dead until it actually is, or the check in thread_s_new should be expanded to include whatever thread is responsible for the at_exit run.

Updated by zenspider (Ryan Davis) over 9 years ago

I don't think main thread should be marked dead until after at_exit is done:

% multiruby -e 'p Thread.current; at_exit { p Thread.current }'

VERSION = mri_trunk
CMD = ~/.multiruby/install/mri_trunk/bin/ruby -e p Thread.current; at_exit { p Thread.current }

#<Thread:0x007f977c0c8fa8 run>
#<Thread:0x007f977c0c8fa8 dead>

RESULT = 0

VERSION = 1.8.7-p249
CMD = ~/.multiruby/install/1.8.7-p249/bin/ruby -e p Thread.current; at_exit { p Thread.current }

#<Thread:0x1014e7350 run>
#<Thread:0x1014e7350 run>

RESULT = 0

VERSION = 1.9.2-p320
CMD = ~/.multiruby/install/1.9.2-p320/bin/ruby -e p Thread.current; at_exit { p Thread.current }

#<Thread:0x007f8ab286b9a8 run>
#<Thread:0x007f8ab286b9a8 run>

RESULT = 0

VERSION = 1.9.3-p194
CMD = ~/.multiruby/install/1.9.3-p194/bin/ruby -e p Thread.current; at_exit { p Thread.current }

#<Thread:0x007fabc386b5c0 run>
#<Thread:0x007fabc386b5c0 run>

RESULT = 0

TOTAL RESULT = 0 failures out of 4

Passed: 1.9.2-p320, 1.8.7-p249, 1.9.3-p194, mri_trunk
Failed:

Updated by zenspider (Ryan Davis) over 9 years ago

This is blocking my merge of minitest to trunk for 2.0 preview.

Updated by kosaki (Motohiro KOSAKI) over 9 years ago

  • Status changed from Open to Closed

fixed at r37958

Actions

Also available in: Atom PDF