3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

control: log remaining threads on shutdown, for debugging freezes

This commit is contained in:
James Lu 2016-12-16 19:42:12 -08:00
parent 95b58fc2c4
commit e7a005b685

View File

@ -3,6 +3,7 @@ control.py - Implements SHUTDOWN and REHASH functionality.
"""
import signal
import os
import threading
from pylinkirc import world, utils, conf, classes
from pylinkirc.log import log, makeFileLogger, stopFileLoggers
@ -40,6 +41,10 @@ def _shutdown(irc=None):
except OSError:
log.exception("Failed to remove PID, ignoring...")
log.info("Waiting for remaining threads to stop; this may take a few seconds. If PyLink freezes "
"at this stage, press Ctrl-C to force a shutdown.")
log.debug('_shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()])
# Done.
def sigterm_handler(signo, stack_frame):