Support stack on Geard embedded server

The Zuul server supports dumping stacktrace by sending a SIGUSR2 signal.
Move the signal registration before the fork of the Gearman embedded
server to make it support the same behavior.

Clarify the relevant documentation to mention the forked process that
supports the embedded Gearman server supports SIGUSR2. Additionally
mentioned the log bucket being used (zuul.stack_dump) which might help
fine tweaking of the logger configuration.

Change-Id: I274cc7aba0eee624aafd3b75de15d6e26bdc8d21
This commit is contained in:
Antoine Musso 2014-10-28 21:35:22 +01:00
parent 548cfda41a
commit 29eab01ba3
2 changed files with 6 additions and 4 deletions

View File

@ -1050,9 +1050,11 @@ recheck changes for the gate and check pipelines respectively::
./tools/zuul-changes.py --review-host=review.openstack.org \
http://zuul.openstack.org/ check 'recheck no bug'
If you send a SIGUSR2 to the zuul-server process, Zuul will dump a stack
trace for each running thread into its debug log. This is useful for
tracking down deadlock or otherwise slow threads.
If you send a SIGUSR2 to the zuul-server process, or the forked process
that runs the Gearman daemon, Zuul will dump a stack trace for each
running thread into its debug log. It is written under the log bucket
``zuul.stack_dump``. This is useful for tracking down deadlock or
otherwise slow threads.
When `yappi <https://code.google.com/p/yappi/>`_ (Yet Another Python
Profiler) is available, additional functions' and threads' stats are

View File

@ -150,6 +150,7 @@ class Server(zuul.cmd.ZuulApp):
import zuul.webapp
import zuul.rpclistener
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()
@ -203,7 +204,6 @@ class Server(zuul.cmd.ZuulApp):
signal.signal(signal.SIGHUP, self.reconfigure_handler)
signal.signal(signal.SIGUSR1, self.exit_handler)
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
signal.signal(signal.SIGTERM, self.term_handler)
while True:
try: