From: "BertramScharpf (Bertram Scharpf)" Date: 2013-11-27T21:49:30+09:00 Subject: [ruby-core:58643] [ruby-trunk - Bug #9167][Open] Segmentation fault in cleanup Issue #9167 has been reported by BertramScharpf (Bertram Scharpf). ---------------------------------------- Bug #9167: Segmentation fault in cleanup https://bugs.ruby-lang.org/issues/9167 Author: BertramScharpf (Bertram Scharpf) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p448 (2013-06-27 revision 41675) [i386-ruby 1.9.3p448 (2013-06-27 revision 41675) [i386-freebsd9]freebsd9] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN 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 -- http://bugs.ruby-lang.org/