Project

General

Profile

Actions

Bug #12278

closed

Sometimes I have segmentation fault with procs reducer

Bug #12278: Sometimes I have segmentation fault with procs reducer

Added by newmen (Gleb Averchuk) over 9 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
[ruby-core:74934]

Description

Hello,

Sometimes I have segmentation fault for code like:

 # /Users/newmen/projects/versatile-diamond/analyzer/lib/modules/procs_reducer.rb:35 8 # Combines passed procs to one function 9 # @param [Array] procs which will be combined 10 # @yield returns heart of combination result 11 # @return [Proc] the general function which contains calls of all other nested 12 def reduce_procs(procs, &deepest_block) 13 procs.reverse.reduce(deepest_block) do |acc, block| 14 -> { block[&acc] } 15 end 16 end 17 18 # Calls combined procs as one function 19 # @param [Array] procs which will be combined 20 # @yield returns heart of combination result 21 # @return [Object] 22 def call_procs(procs, &block) 23 reduce_procs(procs, &block).call 24 end 25 26 # Collects procs which nests each other, after than calls combined procedure 27 # @param [Proc] deepest_block the block for the deepest call 28 # @yield [Symbol, Array, Hash] nests the some method call 29 # @return [Object] the result of deepest block call 30 def inlay_procs(deepest_block, &block) 31 procs = [] 32 nest = -> method_name, *args, **kwargs do 33 procs << 34 if kwargs.empty? 35 -> &prc { send(method_name, *args, &prc) } 36 else 37 -> &prc { send(method_name, *args, **kwargs, &prc) } 38 end 39 end 40 41 block[nest] 42 call_procs(procs, &deepest_block) 43 end 

Console report and crash log files are attached.
Both attached source files were written about 2 years ago.


Files

report.log (107 KB) report.log newmen (Gleb Averchuk), 04/13/2016 06:13 PM
ruby_2016-04-13-205136_primemind.crash (27.4 KB) ruby_2016-04-13-205136_primemind.crash newmen (Gleb Averchuk), 04/13/2016 06:14 PM
procs_reducer.rb (1.44 KB) procs_reducer.rb newmen (Gleb Averchuk), 04/13/2016 06:19 PM
minuend_spec.rb (5.43 KB) minuend_spec.rb ProcsReducer#inlay_procs usage newmen (Gleb Averchuk), 04/13/2016 06:25 PM

Updated by nobu (Nobuyoshi Nakada) over 9 years ago Actions #1 [ruby-core:75042]

Seems a GC bug of a Proc created by Symbol#to_proc.
I suspect that it is a fixed bug, but can't find the ticket now.

Updated by windwiny (wind winy) over 9 years ago Actions #2 [ruby-core:75044]

Did you had use jemalloc compile ruby?

Updated by newmen (Gleb Averchuk) over 9 years ago Actions #3 [ruby-core:75072]

wind winy wrote:

Did you had use jemalloc compile ruby?

I've installed Ruby using RVM

Updated by ko1 (Koichi Sasada) over 9 years ago Actions #4 [ruby-core:75273]

Do you have easy reproducible code which we can try?

Updated by newmen (Gleb Averchuk) over 9 years ago Actions #5 [ruby-core:75279]

  • Subject changed from Sometimes I have segmentation fault with props reducer to Sometimes I have segmentation fault with procs reducer

Updated by newmen (Gleb Averchuk) over 9 years ago Actions #6 [ruby-core:75280]

Koichi Sasada wrote:

Do you have easy reproducible code which we can try?

The error has occurred suddenly everytime. Almost always, I got it during RSpec tests run.
Before, I was not able to write a simple example for provoke an error. Also, I have noted that on 2.2.4 the error does not occur, and since then I use it. But now, following your request, I will continue to use 2.3.0 intentionally to catch the error and extract the simple reproducing code. I'll let you know if I will find it.

Updated by jeremyevans0 (Jeremy Evans) over 6 years ago Actions #7

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom