Bug #8230

Segmentation fault: at_exit

Added by Peter Leonov about 1 year ago. Updated 12 months ago.

[ruby-core:54068]
Status:Open
Priority:Normal
Assignee:-
Category:core
Target version:-
ruby -v:ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1] Backport:

Description

Got segfault usin TextMate run script window. Thought it up to TextMate and started to digg.
Ended up with heisenbug in at_exit.

STEPS:

Download two files:
* atexit.rb
* big
file.rb

save these to some dir, chdir there and run:

ruby -r ./at_exit.rb -e 'q'

EXPECTED:

Error message like this:

-e:1:in `<main>': undefined local variable or method `q' for main:Object (NameError)

RESULT:

A segmentation fault. Output of the crash can be found in crash-output.txt attached below.

NOTES:

I have gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00).

If you look at the content of the files you could see lots of useless statements. It is OK, bug shows itself with all that garbage only.

While Ruby 2.0 couldn't be built on Mac OS X today I can't test this issue in it. But, it is ease to see about this bug it is all about stack corruption. If necessary, I can help with debugging on my box.

at_exit.rb Magnifier (545 Bytes) Peter Leonov, 04/07/2013 08:43 AM

big_file.rb Magnifier (21.4 KB) Peter Leonov, 04/07/2013 08:43 AM

crash-output.txt Magnifier (1.43 KB) Peter Leonov, 04/07/2013 08:43 AM

History

#1 Updated by Peter Leonov about 1 year ago

~/Library/Logs/CrashReporter/ is empty, and /Library/Logs/CrashReporter/ doesn't exist.

#2 Updated by Peter Leonov about 1 year ago

(gdb) bt
#0 0x00007fff8c484212 in _pthreadkill ()
#1 0x00007fff8578fb54 in pthreadkill ()
#2 0x00007fff857d3dce in abort ()
#3 0x0000000108970ac9 in rb
bug ()
#4 0x0000000108a15d7f in sigsegv ()
#5
#6 0x0000000108a6e971 in rbbackrefget ()
#7 0x00000001089f660b in rbregsearch ()
#8 0x00000001089f1797 in rbregmatch ()
#9 0x0000000108a78753 in vmexeccore ()
#10 0x0000000108a7971e in vmexec ()
#11 0x0000000108a7aee1 in rb
vminvokeproc ()
#12 0x0000000108973e21 in rbexecendproc ()
#13 0x0000000108973ee5 in ruby
finalize0 ()
#14 0x0000000108974002 in ruby
cleanup ()
#15 0x0000000108974269 in rubyrunnode ()
#16 0x000000010893d67f in main ()

#3 Updated by Motohiro KOSAKI about 1 year ago

At least i couldn't reproduce on trunk.

% build/ruby-trunk --disable-gems -v -r ./atexit.rb -e "q"
ruby 2.1.0dev (2013-04-07 trunk 40172) [x86
64-darwin12.3.0]
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:4: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:5: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:6: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:7: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:8: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:9: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:10: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:11: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/atexit.rb:12: warning: unused literal ignored
/Users/kosaki/ruby/git/at
exit.rb:12: warning: unused literal ignored
-e:1:in <main>': undefined local variable or methodq' for main:Object (NameError)

#4 Updated by Masaki Matsushita about 1 year ago

I couldn't reproduce on trunk r40172 and ruby 1.9.3p392.

#5 Updated by Charlie Somerville 12 months ago

Reproduced on 1.9.3p392, but not trunk or 2.0.0p0

Also available in: Atom PDF