Centrally register stack dump handler

We want the stack dump handler to be present in all zuul apps so this
can be registered in a central place.

Change-Id: I0c4a97d6ee983aa4d57928682dfb6eeffd050197
This commit is contained in:
Tobias Henkel 2017-12-27 10:17:29 +01:00
parent a56402e4d6
commit 30cbb65b43
5 changed files with 4 additions and 7 deletions

View File

@ -176,6 +176,10 @@ class ZuulDaemonApp(ZuulApp):
pid_fn = self.getPidFile()
pid = pid_file_module.TimeoutPIDLockFile(pid_fn, 10)
# Early register the stack dump handler for all zuul apps. This makes
# it possible to also gather stack dumps during startup hangs.
signal.signal(signal.SIGUSR2, stack_dump_handler)
if self.args.nodaemon:
self.run()
else:

View File

@ -130,8 +130,6 @@ class Executor(zuul.cmd.ZuulDaemonApp):
log_streaming_port=self.finger_port)
self.executor.start()
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
if self.args.nodaemon:
signal.signal(signal.SIGTERM, self.exit_handler)
while True:

View File

@ -62,8 +62,6 @@ class Merger(zuul.cmd.ZuulDaemonApp):
self.connections)
self.merger.start()
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
if self.args.nodaemon:
signal.signal(signal.SIGTERM, self.exit_handler)
while True:

View File

@ -123,7 +123,6 @@ class Scheduler(zuul.cmd.ZuulDaemonApp):
import zuul.webapp
import zuul.zk
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
if (self.config.has_option('gearman_server', 'start') and
self.config.getboolean('gearman_server', 'start')):
self.start_gear_server()

View File

@ -106,8 +106,6 @@ class WebServer(zuul.cmd.ZuulDaemonApp):
self.configure_connections()
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
try:
self._run()
except Exception: