Skip to content

Commit 0fec801

Browse files
authored
Merge pull request Supervisor#1176 from livanh/master
Avoid possible race condition between SIGTERM and SIGHUP
2 parents 77ded5a + 2511b0e commit 0fec801

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

supervisor/supervisord.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,13 @@ def handle_signal(self):
292292
'received %s indicating exit request' % signame(sig))
293293
self.options.mood = SupervisorStates.SHUTDOWN
294294
elif sig == signal.SIGHUP:
295-
self.options.logger.warn(
296-
'received %s indicating restart request' % signame(sig))
297-
self.options.mood = SupervisorStates.RESTARTING
295+
if self.options.mood == SupervisorStates.SHUTDOWN:
296+
self.options.logger.warn(
297+
'ignored %s indicating restart request (shutdown in progress)' % signame(sig))
298+
else:
299+
self.options.logger.warn(
300+
'received %s indicating restart request' % signame(sig))
301+
self.options.mood = SupervisorStates.RESTARTING
298302
elif sig == signal.SIGCHLD:
299303
self.options.logger.debug(
300304
'received %s indicating a child quit' % signame(sig))

0 commit comments

Comments
 (0)