1. cherrypy
  2. CherryPy
Issue #1101 resolved

Starting CherryPy in a Thread Locks when the Engine Restarted

Anonymous created an issue

Starting CherryPy in a thread causes a lockup when the engine restarts. The process is created as follows (interface/web.py)

{{{

!/usr/bin/env python

import cherrypy import threading

class listener( threading.Thread ):

def __init__( self, port, parent_object ):
    threading.Thread.__init__( self )
    self.daddy = parent_object
    self.cpy = None

def run( self ):
    self.cpy = cherrypy.quickstart( self )

def stop( self ):
    self.cpy.stop()

}}}

and created as

{{{ web_interface = interface.web.listener( 8080, self ) }}}

When web.py is updated, it hangs waiting for the main thread

{{{ [01/Nov/2011:14:00:34] ENGINE Restarting because /Users/tyndyll/Desktop/spEos/src/interface/web.py changed. INFO:cherrypy.error:[01/Nov/2011:14:00:34] ENGINE Restarting because /Users/tyndyll/Desktop/spEos/src/interface/web.py changed. [01/Nov/2011:14:00:34] ENGINE Stopped thread 'Autoreloader'. INFO:cherrypy.error:[01/Nov/2011:14:00:34] ENGINE Stopped thread 'Autoreloader'. [01/Nov/2011:14:00:34] ENGINE Bus STOPPING INFO:cherrypy.error:[01/Nov/2011:14:00:34] ENGINE Bus STOPPING [01/Nov/2011:14:00:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) shut down INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) shut down [01/Nov/2011:14:00:37] ENGINE Stopped thread '_TimeoutMonitor'. INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Stopped thread '_TimeoutMonitor'. [01/Nov/2011:14:00:37] ENGINE Bus STOPPED INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Bus STOPPED [01/Nov/2011:14:00:37] ENGINE Bus EXITING INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Bus EXITING [01/Nov/2011:14:00:37] ENGINE Bus EXITED INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Bus EXITED [01/Nov/2011:14:00:37] ENGINE Waiting for child threads to terminate... INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Waiting for child threads to terminate... [01/Nov/2011:14:00:37] ENGINE Waiting for thread MainThread. INFO:cherrypy.error:[01/Nov/2011:14:00:37] ENGINE Waiting for thread MainThread. }}}

It remains in this state until it is stopped via Ctrl+C

Comments (1)

  1. Log in to comment