Skip to content

Commit d0ed4d7

Browse files
authored
Merge pull request #86 from jhjaggars/dump-stacks
kill -1 will dump all the stacks for all coroutines
2 parents 705a973 + acf330f commit d0ed4d7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

receptor/__main__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import asyncio
12
import logging
23
import logging.config
4+
import signal
35
import sys
46

57
from .config import ReceptorConfig
@@ -47,6 +49,12 @@ def _f(record):
4749
for h in logging.getLogger('receptor').handlers:
4850
h.addFilter(_f)
4951

52+
def dump_stacks(signum, frame):
53+
for t in asyncio.Task.all_tasks():
54+
t.print_stack(file=sys.stderr)
55+
56+
signal.signal(signal.SIGHUP, dump_stacks)
57+
5058
try:
5159
config.go()
5260
except Exception:

0 commit comments

Comments
 (0)