Ticket #43 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

preforkserver alarm not reset after SIGHUP

Reported by: trac Assigned to: asaddi
Priority: minor Milestone: flup.server-1.0.3
Component: flup.server Version: 1.0.2
Keywords: Cc:

Description

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)

Change History

11/04/09 08:47:41 changed by asaddi

  • status changed from new to closed.
  • resolution set to fixed.

Good catch. I also fixed it in other places where SIGALRM was used. Thanks!