Open thortex opened 6 years ago
We face the same. I tried it on different Debian Stretch, Buster and Bullseye systems with different Python 2 and 3 versions, with and without debug flag -d
, SIGTERM leads to infinite 100% CPU usage without ever stopping. systemd SIGKILLs the process after 90 seconds timeout, manually this works as well of course.
python3 -m webiopi -d
is the easiest way to reproduce this without any systemd and config impact.
Important to note that we use this fork, but I also saw it on the original (unpatched) v0.7.1.
I tried strace python3 -m webiopi -d
, but SIGTERM works there without any additional output. It seems strace
itself kills the process successfully or probably invokes it in a way there the issue does not appear.
Not sure whether this fork is actively used/developed, but I'm open to help debug and test the underlying issue, if someone with more insights and Python knowledge can point me into the right direction or suggest debug steps I can do.
The HTTP server is the culprit, or how it is handled/threaded. Disabling it, respectively adding http_enabled = False
in webiopi/server/__init__.py
solves the issue.
self.http_server.stop()
is definitely called and I see added debug output after that call.
There self.server_close()
in the HTTPServer
as well is called. Checking the docs about the http.server
class: https://docs.python.org/3/library/http.server.html
self.serve_forever()
is called as part of the socketserver parent class, but an added debug print after that call is never done.self.server_close()
is called, an added debug print before and after is shown, but it seems to not have the intended effect (although ss -tulp
doesn't show the listening port anymore).self.shutdown()
was missing. Adding it before or after self.server_close()
successfully stops the webserver and with it the whole WebIOPi process.PR up: #57