unicorn segfaulting on Array.shuffle under ruby 1.9.1

Eric Wong normalperson at yhbt.net
Sun Mar 14 19:53:57 EDT 2010

Bharanee Rathna <deepfryed at gmail.com> wrote:
> Hi Guys,
> http://gist.github.com/332266
> results in a segfault when run under unicorn.  It seems to be fine
> with webrick or thin. Any ideas ?

Hi Bharanee, it looks like the random number generator needs to be
reinitialized after fork()...

Try putting "rand" anywhere before shuffle, you can reproduce
it below even without Unicorn:

------------------- 8< ----------------
pid = fork do
  rand # removing this will segfault
p Process.waitpid2(pid)
------------------- 8< ----------------

I'll see if I can fix it and follow up with a report to ruby-core/redmine

Eric Wong

More information about the mongrel-unicorn mailing list