Google Groups

Re: Possible GC bug w/ fork() and Queue

netshade Mar 26, 2012 6:47 AM
Posted in group: Ruby Enterprise Edition
After further checking, GC was not exactly the issue.  The problem
seems to originate from the MBARI patches, more information here: .

On Mar 19, 10:04 am, netshade <> wrote:
> We've got reports from some of our customers that they are getting
> occasional segfaults when using Ruby Enterprise Edition in concert
> with a library that is using threads and the Queue class.  After some
> research, we were able to narrow it down to what looks to be a junk
> pointer in the Queue class' value_available ConditionVariable var
> ( the error occurs in eval.c#rb_thread_check(), when it attempts to
> check the type of a thread inside the Queue's .value_available
> ConditionVariable's .waiting List at the time of the GC calling
> free_queue() ).
> You can reproduce the error by doing the following:
>  ruby  -rthread -e 'q =; { q.pop }; pid = fork;
> if pid.nil?; q = nil; GC.start; else; puts "Waiting on #{pid}";
> Process.wait(pid); end'
> In REE, I get an error like the following:
>  wrong argument type Object (expected Thread) (TypeError)
> In stock 1.8.7, I don't receive an error.
> I believe what is happening is that at fork() time something is
> trashing (or failing to copy) the thread entry for the Queue popper
> thread that is in the original process' ConditionVariable .waiting
> list.  Can someone from the Phusion team verify this bug?
> Thanks,
> Chris Zelenak