cherrymusic
cherrymusic copied to clipboard
cherrypy gets wedged when you try to gracefully shut down
This is a problem I've noticed both when I have systemd run cherrymusic as a service, and when I just load cherrymusicd up in a console and hit Ctrl-C - the program just fails to shut down. If I keep banging on Ctrl-C in the console case, or let systemd eventually SIGKILL the daemon in that case, it will eventually die.
Through printf-debugging I've figured out that the program successfully runs stopAndCleanUp
in cherrymusicserver/init.py, and the problem lies somewhere in cherrypy/process/wspbus.py. It looks like the publish
handler there gets a 'stop' channel argument, then gets a 'log' channel argument, and then somehow manages to keep running. I don't understand cherrypy well enough to know what might be going on here. I did figure out that if I make that function crash when it gets a 'stop' message, the program will shut down - if I add
if channel == 'stop':
raise Exception
as the first thing in publish
, the program halts as expected - although I don't know what havoc I'm wrecking with the cherrypy event system by doing so.