Bharanee Rathna
2010-Mar-14 22:00 UTC
unicorn segfaulting on Array.shuffle under ruby 1.9.1
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 ? - bharanee
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 (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
Eric Wong <normalperson at yhbt.net> wrote:> I''ll see if I can fix it and follow up with a report to ruby-core/redmineI managed to report the issue here (and managed to not forget the attachment, this might be a first) http://redmine.ruby-lang.org/issues/show/2962 -- Eric Wong