Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions emrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ def do_POST(self):
if not emrun_options.serve_after_exit:
page_exit_code = int(data[6:])
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().')
if emrun_options.force_exit:
self.server.socket.setblocking(False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a downside to always doing this? I mean, instead of adding an option, to always set nonblocking after the page exits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From our side there is no downside specific to this change. We just thought that it might be categorically better received if it were presented as an option, but there is no downside to always doing this before shutdown.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then I think it's better to avoid adding an option actually. That way it will be fully tested.

self.server.shutdown()
return
else:
Expand Down Expand Up @@ -1563,6 +1565,9 @@ def parse_args(args):
parser.add_argument('--dump-out-directory', default='dump_out', type=str,
help='If specified, overrides the directory for dump files using emrun_file_dump method.')

parser.add_argument('--force-exit', action='store_true',
help='If true, sets server socket to nonblocking on shutdown to avoid sporadic deadlocks.')

parser.add_argument('serve', nargs='?', default='')

parser.add_argument('cmdlineparams', nargs='*')
Expand Down