diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-04-18 22:21:58 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-04-18 15:28:29 -0700 |
commit | b32416211ef30e958ec38c8c99833161cd476dd4 (patch) | |
tree | 56355cfced746a102bd8139ce09145b9ae4bdf59 /lib/unicorn | |
parent | 3c8f21a4257578e9cdc4781dd21a6a572e25ca54 (diff) | |
download | unicorn-b32416211ef30e958ec38c8c99833161cd476dd4.tar.gz |
The current versions of Ruby 1.8 do not reseed the PRNG after forking, so we'll work around that by calling Kernel#srand. ref: http://redmine.ruby-lang.org/issues/show/4338
Diffstat (limited to 'lib/unicorn')
-rw-r--r-- | lib/unicorn/http_server.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 07d0b4f..2706568 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -484,14 +484,19 @@ class Unicorn::HttpServer next_sleep end + def after_fork_internal + @ready_pipe.close if @ready_pipe + @ready_pipe = nil + srand # http://redmine.ruby-lang.org/issues/4338 + end + def spawn_missing_workers (0...worker_processes).each do |worker_nr| WORKERS.values.include?(worker_nr) and next worker = Worker.new(worker_nr, Unicorn::TmpIO.new) before_fork.call(self, worker) WORKERS[fork { - ready_pipe.close if ready_pipe - self.ready_pipe = nil + after_fork_internal worker_loop(worker) }] = worker end |