From: ynnor@... Date: 2017-05-30T14:55:49+00:00 Subject: [ruby-core:81474] [Ruby trunk Bug#13612] Segmentation Fault Issue #13612 has been updated by rovf (Ronald Fischer). There is one more observation I would like to add; I don't know whether or not this is important: When the segmentation fault occured the first time in our original application with Cygwin MRI Ruby, I reexecuted the whole application with JRuby, because I suspected that I might run out of memory due to a memory leak, and while JRuby certainly does not have the the same memory footprint as MRI Ruby, given the huge amount of input data, a leak caused by my own programming would likely show up in JRuby too. Too my surprise, the JRuby execution already crashed after a couple of seconds, not after many minutes, and it was (of course) not a Segmentation Fault, but a NoMethodError: Due to a programming error, a variable v was nil, and when I applied v.times {....}, it crashed of course. Now what was really surprising, that it **should** have crashed under MRI Ruby too immediately. Same program, same data, and an obvious bug! Anyway, I fixed the bug, and executed it again on MRI Ruby - and no segmentation fault. After some time, I run the program again with a different set of input data. Again, MRI Ruby got a segmentation fault. Running it with JRuby showed, like before, a similar programming error, just in a completely different module. Here too, the culprit was an object which was nil, and where I forgot to catch this fact. And, like before, after fixing this bug, running on MRI Ruby did not crash anymore! Now I had two cases where MRI Ruby - at least the Cygwin port - did not manage to catch the fact that I am mistakingly was using a nil object. I have no idea, what Ruby did **instead**. It's supposed to throw an exception in such a case, and **usually** it DOES throw an exception. So far, it misbehaved only in this two cases. ---------------------------------------- Bug #13612: Segmentation Fault https://bugs.ruby-lang.org/issues/13612#change-65182 * Author: rovf (Ronald Fischer) * Status: Feedback * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-cygwin] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- I got a segmentation fault, fllowed by the message "You may have encountered a bug in the Ruby interpreter or extension libraries.". See attachment. The exception occured in this piece of code: ```ruby class EXPERT FIND_CHAIN_FOR_POS_FILTER_PIPELINE = [ :no_filter, :filter_by_etkz_e, :filter_chain_in_chain, ].each def find_chain_for_pos(sw_lines_for_module, wsc_sw_lines) FIND_CHAIN_FOR_POS_FILTER_PIPELINE.rewind begin while NVP.multiple_grpids?(sw_lines_for_module) filter_method_symb = FIND_CHAIN_FOR_POS_FILTER_PIPELINE.next # <----- This is line 30, where the exception reportedly occured. sw_lines_for_module = NVP.send(filter_method_symb, br, sw_lines_for_module) end rescue StopIteration LOG.trace "Could not find unique GRPID" end end end ``` The segmentation fault occurs only after this method has been executed repeatedly several hundred times. ---Files-------------------------------- ruby_segf.txt (18.5 KB) segf_test.rb (1.49 KB) segf_test_improved.rb (1.54 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: