Segmentation fault in cleanup
I don't know whether it is the interpreters fault or mine.
This is what I do:
- Subclassing StandardError in C
- Encapsulating some data into it using Data_Make_Struct
- Raising this exception
- Not catching it by "rescue"
If I catch it by "rescue", everything is fine. If I don't, the
finalizer crashes with a segmentation fault.
I made a gem out of it containting the full example and a little
bit more description. See the attached file.
This gem contains a build dependency, so you probably prefer to
untar it and compile it on the command line by "cc". This is what
I have to do here:
$ cc -c -DHAVE_HEADER_RUBY_RUBY_H -I/usr/local/include/ruby-1.9 -I/usr/local/include/ruby-1.9/i386-freebsd9 -fPIC -o dataerr.o dataerr.c
$ cc --shared -o dataerr.so dataerr.o
$ ruby -r ./dataerr -e 'begin ; raise_it! ; rescue ; end'
-> Return code 0
$ ruby -r ./dataerr -e 'raise_it!'
-> Segmentation fault
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r43930.
Bertram, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
eval.c: determine exit status and signal before finalization
- eval.c (ruby_cleanup): determine exit status and signal to terminate before finalization, to get rid of access destroyed T_DATA execption object. [ruby-core:58643] [Bug #9167]