-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: emrun.py does not exit as expected #22578
Comments
We could as |
I think the missing module has nothing to do with the
I dont know why a thread prevents the Sorry about mentioning two problems in one issue, I should have made a separate issue for the last sentence. |
Hi, we observe the same issue on Windows: emrun will often hang after the server shuts down. We noticed that, as suggested above, setting the server's block_on_close to False sometimes helped, https://docs.python.org/3/library/socketserver.html
but sometimes the program would still block on sys.exit(...). We could then also replace that with os._exit(...) instead
And this combination then worked reliably but seems dirty. I think the reason sys.exit would hang if block_on_close were set to False is that then the server's daemon threads are not joined on close https://github.com/python/cpython/blob/main/Lib/socketserver.py#L673C7-L673C21 So we found a (comparatively) cleaner solution to just set the server's socket itself to non-blocking before shutdown. This way the threads can still be joined and the ordinary and cleaner sys.exit(...) exit function can be used. Here is a diff that we propose to be adopted (which makes this behaviour a program option for emrun).
Pull request: #22577 |
After the program in the browser finished emrun just hangs at:
httpd.server_close()
Command:
Output:
Possible fix: (Disclaimer: I have no python skills)
I am not sure if this is a problem on operating systems other than Windows.
It also looks like the python deployed with emsdk is missing a module 'psutil'. I guess this would cause
--kill_start
to not work.The text was updated successfully, but these errors were encountered: