From: Greg.mpls@... Date: 2019-04-19T13:38:27+00:00 Subject: [ruby-core:92331] [Ruby trunk Bug#15766] Crash in 2.4, 2.5 involving at_exit Issue #15766 has been updated by MSP-Greg (Greg L). I can repo the issues with ruby 2.4.6p354 (2019-04-01 revision 67394) [x64-mingw32] 2.5 & 2.6 do not SEGV. ---------------------------------------- Bug #15766: Crash in 2.4, 2.5 involving at_exit https://bugs.ruby-lang.org/issues/15766#change-77673 * Author: christian.boos@free.fr (Christian Boos) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Hello, I've written a piece of code which reproducibly triggers a crash in some versions of Ruby (2.4 and 2.5, but not 2.2, 2.3 nor 2.6). As this involves Minitest, I've started by filing a bug report on GitHub: https://github.com/seattlerb/minitest/issues/789 However, as this triggers a crash, I've been advised to report it here as well. Also, I wasn't able to find a similar bug report. I have not looked too deep, but it seems that the way Minitest deals with `atexit` handlers exposes a problem when there's a pending `LocalJumpError`. You will find all the details in the Minitest bug 789, but let me summarize them again here: ```ruby require 'minitest/autorun' require 'minitest/spec' describe 'a simple crash reproducer' do before { return } # /!\ it 'checks stuff' do end end ``` Executing the above with the default minitest (or any newer version) won't work as a local return is not expected from within a `before` call (same thing for `after`). But depending on the version, we may get a crash in addition to the error report: - `ruby 2.2.5p319 (2016-04-26 revision 54774) [x64-mingw32]` => `LocalJumpError: unexpected return` (no crash) - `ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]` => `LocalJumpError: unexpected return` (no crash) - `ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]` => `unexpected return` (+ CRASH) - `ruby 2.4.5p335 (2018-10-18 revision 65137) [x64-mingw32]` => `unexpected return` (+ CRASH) - `ruby 2.5.0p0 (2017-12-25 revision 61468) [x64-mingw32]` => `unexpected return` (+ CRASH) - `ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]` => `unexpected return` (+ CRASH) - `ruby 2.6.0p0 (2018-12-25 revision 66547) [x64-mingw32]` => `unexpected return` (no crash) - `ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32]` => `unexpected return` (no crash) I'm mainly developing on Windows, and use the pre-built versions from rubyinstaller.org, but in order to be sure that this is *not* a Windows-specific issue, I also tried Ruby 2.5.0p0 and 2.5.1p57 on Linux and I get the same crash. That crash always takes the same form: ``` D:/Workspace/install/windows64/ruby-2.4/lib/ruby/gems/2.4.0/gems/minitest-5.10.3/lib/minitest.rb:60: [BUG] Segmentation fault -- Control frame information ----------------------------------------------- c:0003 p:---- s:0011 e:000010 CFUNC :exit c:0002 p:0027 s:0006 e:000005 BLOCK D:/Workspace/install/windows64/ruby-2.4/lib/ruby/gems/2.4.0/gems/minitest-5.10.3/lib/minitest.rb:60 [FINISH] c:0001 p:0000 s:0003 E:000520 (none) [FINISH] ``` As the problem doesn't happen with 2.6, I did hope that this problem would also be fixed in recent 2.4 and 2.5, but the problem is still present for 2.4.5p335 and 2.5.3p105 at least (latest versions from rubyinstaller.org). -- https://bugs.ruby-lang.org/ Unsubscribe: