From: "zenspider (Ryan Davis)" Date: 2012-11-29T09:40:27+09:00 Subject: [ruby-core:50278] [ruby-trunk - Bug #7459] at_exit { Thread.new {} } broken in r37921 Issue #7459 has been updated by zenspider (Ryan Davis). 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 } # # 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 } # # 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 } # # 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 } # # 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: ---------------------------------------- Bug #7459: at_exit { Thread.new {} } broken in r37921 https://bugs.ruby-lang.org/issues/7459#change-34105 Author: zenspider (Ryan Davis) Status: Open Priority: Urgent Assignee: Category: core Target version: 2.0.0 ruby -v: 2.0 ruby -e 'p Thread.current; at_exit { p Thread.current; [Thread.new {}].map(&:join) }' outputs: # # -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. -- http://bugs.ruby-lang.org/