initialize signal handlers before writing pid file
commitcb6d8c71abac83d75d2bc990bdbc84748a1309ea
authorEric Wong <normalperson@yhbt.net>
Wed, 20 Jan 2010 02:09:30 +0000 (19 18:09 -0800)
committerEric Wong <normalperson@yhbt.net>
Wed, 20 Jan 2010 02:31:36 +0000 (19 18:31 -0800)
treeabf5469710b4bb68f0bbfe6650a8aa8ba7b4a2d3
parentaf637c8c64636a97c468e9126dfdc4575d1826aa
initialize signal handlers before writing pid file

This prevents trigger-happy init scripts from reading the pid
file (and thus sending signals) to a not-fully initialized
master process to handle them.

This does NOT fix anything if other processes are sending
signals prematurely without relying on the presence of the pid
file.  It's not possible to prevent all cases of this in one
process, even in a purely C application, so we won't bother
trying.

We continue to always defer signal handling to the main loop
anyways, and signals sent to the master process will be
deferred/ignored until Unicorn::HttpServer#join is run.
lib/unicorn.rb
test/test_helper.rb
test/unit/test_server.rb
test/unit/test_signals.rb
test/unit/test_upload.rb