Skip to content

Commit 17463f7

Browse files
authored
Fix emrun sporadic exit hang on Windows (#22577)
Fixes #22578 We set the server's socket itself to non-blocking before shutdown to avoid deadlock issues with arriving messages.
1 parent 77e24ae commit 17463f7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

emrun.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ def do_POST(self):
704704
if not emrun_options.serve_after_exit:
705705
page_exit_code = int(data[6:])
706706
logv('Web page has quit with a call to exit() with return code ' + str(page_exit_code) + '. Shutting down web server. Pass --serve-after-exit to keep serving even after the page terminates with exit().')
707+
# Set server socket to nonblocking on shutdown to avoid sporadic deadlocks
708+
self.server.socket.setblocking(False)
707709
self.server.shutdown()
708710
return
709711
else:

0 commit comments

Comments
 (0)