Execute engine.restart() in thread hangs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Execute engine.restart() in thread hangs

Steven Sawyer
I'm working on a user-hosted application that needs to periodically check for updates, apply them, then restart.

I have the update checker/installer running in a separate thread, but I can't get it to restart the server. It seems as though calling cherrypy.engine.restart() inside a child thread makes the server hang waiting for that thread to terminate so it can completely shut down. And that thread won't terminate until the restart() call finishes.

Is there a good way to call a server restart from a child thread?

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute engine.restart() in thread hangs

Ryan Tennill

On Friday, December 16, 2016 at 10:37:36 AM UTC-6, Steven Sawyer wrote:
I'm working on a user-hosted application that needs to periodically check for updates, apply them, then restart.

I have the update checker/installer running in a separate thread, but I can't get it to restart the server. It seems as though calling cherrypy.engine.restart() inside a child thread makes the server hang waiting for that thread to terminate so it can completely shut down. And that thread won't terminate until the restart() call finishes.

Is there a good way to call a server restart from a child thread?

How are you deploying/managing your applicaton? If you're using the built in server and autoreloader then you can simply 'touch' a file that's being served and it will restart the server. 

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.