SIGHUP deals w/ dual master pid path scenario
commitc13bec3449396b21795966101367838161612d61
authorEric Wong <normalperson@yhbt.net>
Tue, 13 Jul 2010 08:57:37 +0000 (13 08:57 +0000)
committerEric Wong <normalperson@yhbt.net>
Tue, 13 Jul 2010 08:57:37 +0000 (13 08:57 +0000)
treed2c925ccc1057677bb05ed27f899a53a196f2590
parent3f0f9d6d72cf17b34c130b86eb933bbc513b24b3
SIGHUP deals w/ dual master pid path scenario

As described in our SIGNALS documentation, sending SIGHUP to the
old master (to respawn SIGWINCH-ed children) while the new
master (spawned from SIGUSR2) is active is useful for backing
out of an upgrade before sending SIGQUIT to the new master.

Unfortunately, the SIGHUP signal to the old master will cause
the ".oldbin" pid file to be reset to the non-".oldbin" version
and thus attempt to clobber the pid file in use by the
to-be-terminated new master process.

Thanks to the previous commit to prevent redaemonization in the
new master, the old master can reliably detect if the new master
is active while it is reloading the config file.

Thanks to Lawrence Pit for discovering this bug.
ref: http://mid.gmane.org/4C3BEACF.7040301@gmail.com
lib/unicorn.rb
t/pid.ru [new file with mode: 0644]
t/t0008-back_out_of_upgrade.sh [new file with mode: 0755]