Bharanee Rathna <[email protected]> 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
  (1..10).to_a.shuffle
end
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
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to