diff --git a/docs/topics/extensions.rst b/docs/topics/extensions.rst index fc9993517..0e201da77 100644 --- a/docs/topics/extensions.rst +++ b/docs/topics/extensions.rst @@ -357,15 +357,25 @@ Stack trace dump extension .. class:: scrapy.contrib.debug.StackTraceDump -Dumps the stack trace of a runnning Scrapy process when a `SIGUSR2`_ signal is -received. After the stack trace is dumped, the Scrapy process continues running -normally. +Dumps the stack trace and Scrapy engine status of a runnning process when a +`SIGQUIT`_ or `SIGUSR2`_ signal is received. After the stack trace and engine +status is dumped, the Scrapy process continues running normally. -The stack trace is sent to standard output. +The dump is sent to standard output. This extension only works on POSIX-compliant platforms (ie. not Windows). +There are at least two ways to send Scrapy the `SIGQUIT`_ signal: + +1. By pressing Ctrl-\ while a Scrapy process is running (Linux only?) + +2. By running this command (assuming ```` is the process id of the Scrapy + process):: + + kill -QUIT + .. _SIGUSR2: http://en.wikipedia.org/wiki/SIGUSR1_and_SIGUSR2 +.. _SIGQUIT: http://en.wikipedia.org/wiki/SIGQUIT Debugger extension ~~~~~~~~~~~~~~~~~~ diff --git a/scrapy/contrib/debug.py b/scrapy/contrib/debug.py index 27048efe2..9b4bc3f85 100644 --- a/scrapy/contrib/debug.py +++ b/scrapy/contrib/debug.py @@ -8,18 +8,21 @@ import signal import traceback from pdb import Pdb +from scrapy.utils.engine import print_engine_status + class StackTraceDump(object): def __init__(self): try: signal.signal(signal.SIGUSR2, self.dump_stacktrace) + signal.signal(signal.SIGQUIT, self.dump_stacktrace) except AttributeError: # win32 platforms don't support SIGUSR signals pass def dump_stacktrace(self, signum, frame): - print "Got signal. Dumping stack trace..." traceback.print_stack(frame) + print_engine_status() class Debugger(object):