Commits

Alessio Deiana  committed 2b69d22

SIGUSR1 prints current stack on worker

  • Participants
  • Parent commits 9e57e84

Comments (0)

Files changed (1)

File src/invenio_devserver/serve.py

         self.worker_pid = spawn_server(self.options, self.server_socket)
 
 
+def print_traceback(sig, frame):
+    traceback.print_stack(frame)
+
+
 def start_server(options, server_socket, static_files=config.STATIC_FILES):
     """Start a new http server
 
     wsgi.replace_error_handler()
     wsgi.wrap_warn()
 
+    signal.signal(signal.SIGUSR1, print_traceback)
+
     # Hook debugging console
     if config.USE_CONSOLE or options.use_console:
         from rfoo.utils import rconsole
             start_server(options, server_socket)
         except:
             print traceback.format_exc()[:-1]
-            _log('info', ' * Worker failed to start')
+            _log('info', ' * Worker crashed')
             # We do not want to free this pid because it will be killed
             while True:
                 time.sleep(6000)