Merge "Close stdout *after* binding ports"

This commit is contained in:
Jenkins 2017-07-23 01:12:33 +00:00 committed by Gerrit Code Review
commit d40c9ed3a2

View File

@ -902,9 +902,6 @@ def run_wsgi(conf_path, app_section, *args, **kwargs):
utils.FALLOCATE_RESERVE, utils.FALLOCATE_IS_PERCENT = \ utils.FALLOCATE_RESERVE, utils.FALLOCATE_IS_PERCENT = \
utils.config_fallocate_value(conf.get('fallocate_reserve', '1%')) utils.config_fallocate_value(conf.get('fallocate_reserve', '1%'))
# redirect errors to logger and close stdio
capture_stdio(logger)
# Start listening on bind_addr/port # Start listening on bind_addr/port
error_msg = strategy.do_bind_ports() error_msg = strategy.do_bind_ports()
if error_msg: if error_msg:
@ -912,6 +909,10 @@ def run_wsgi(conf_path, app_section, *args, **kwargs):
print(error_msg) print(error_msg)
return 1 return 1
# Redirect errors to logger and close stdio. Do this *after* binding ports;
# we use this to signal that the service is ready to accept connections.
capture_stdio(logger)
no_fork_sock = strategy.no_fork_sock() no_fork_sock = strategy.no_fork_sock()
if no_fork_sock: if no_fork_sock:
run_server(conf, logger, no_fork_sock, global_conf=global_conf) run_server(conf, logger, no_fork_sock, global_conf=global_conf)