When I send a SIGGUP to a prefork server, it shuts down gracefully as expected. The shutdown code includes a 10 second alarm, to make sure the shutdown occurs
oldSIGALRM = signal.getsignal(signal.SIGALRM)
signal.signal(signal.SIGALRM, alrmHandler)
signal.alarm(10)
If everything works then the shutdown takes well less than 10 seconds. In my case I reloaded some configuration data and started again, only to have my handler get the alarm message after it had restarted.
The solution is simple - add 'signal.alarm(0)' before doing
signal.signal(signal.SIGALRM, oldSIGALRM)