Issue #8100 has been updated by wardrop (Tom Wardrop).


I'm also getting segfaults on Ruby 2.0.0. It seems to be related to threading or forking. Can't quite put my figure on it. All I can say is that I don't get in when running my web app in WEBrick on my Mac, but if running it on my CentOS server with Phusion Passenger using the smart spawn method, I get it all the time, about every 10th request it segfaults. Setting passenger to a conservative spawn method (one request per process) reduces the segfault rate considerably, but they still occur.

Here's a stack overflow thread about it, with a response I left on there with a bit more information about my experiences: http://stackoverflow.com/questions/15315809/segfault-error-in-sinatra-after-upgrading-to-ruby-2-0-beta/15492401#15492401

I also reported this to the Phusion Passenger Google Group before realising it's a problem with ruby 2.0.0: https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/iEOE4shl_jE

Here's a log including numerous segfaults from my CentOS server running Phusion Passenger: https://gist.github.com/Wardrop/5179380

----------------------------------------
Bug #8100: Segfault in trunk
https://bugs.ruby-lang.org/issues/8100#change-37721

Author: judofyr (Magnus Holm)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: current: 2.1.0
ruby -v: ruby 2.1.0dev (2013-03-18 trunk 39805) [x86_64-linux]


=begin
Full backtrace (both VM, C and Ruby) is both attached and available at https://travis-ci.org/rtomayko/tilt/jobs/5479138

I haven't been able to reproduce it (and thus I can't create a reduced test case).

This is the test that fails: https://github.com/rtomayko/tilt/blob/581230cbb3b314e88cf5ec9167a24ebb8acc7a93/test/tilt_compilesite_test.rb#L31

The code in question will do these steps in several threads at the same time:

* https://github.com/rtomayko/tilt/blob/581230cbb3b314e88cf5ec9167a24ebb8acc7a93/lib/tilt/template.rb#L212
* Define a method called "_tilt_#{Thread.current.id.abs}" on Object
* Grab the UnboundMethod
* Undefine the method from Object
* https://github.com/rtomayko/tilt/blob/581230cbb3b314e88cf5ec9167a24ebb8acc7a93/lib/tilt/template.rb#L144
* Then it binds the UnboundMethod to an object and calls it

The method is doing some funky `class << self` to ensure that it gets evaluated under a proper constant scope). It's also caching the methods, so it won't always define a new method, but might re-use another UnboundMethod from a previous compilation (that might have happened on a different thread).

I know it's not much to go after, but at least the backtrace seems to suggest that the error happend in rb_ary_fill in array.c.

I've also had another report of segfault in Tilt + Ruby 2.0.0, but I don't have the full backtrace yet: https://github.com/rtomayko/tilt/issues/179. Might this be related?

Let me know if you need more details.
=end


-- 
http://bugs.ruby-lang.org/