Close stdout *after* binding ports

Otherwise probe tests think services are up when they aren't actually
available yet.

Related-Change: I045f4c9aa2c07cdc5ed95afd028540f1b3874637
Change-Id: Iab923c4f48ac7a5dd41237761ed91d01a59dc77c
This commit is contained in:
Tim Burke 2017-07-22 00:42:37 +00:00
parent 5b10cf530b
commit 31f4794c12
1 changed files with 4 additions and 3 deletions

View File

@ -902,9 +902,6 @@ def run_wsgi(conf_path, app_section, *args, **kwargs):
utils.FALLOCATE_RESERVE, utils.FALLOCATE_IS_PERCENT = \
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
error_msg = strategy.do_bind_ports()
if error_msg:
@ -912,6 +909,10 @@ def run_wsgi(conf_path, app_section, *args, **kwargs):
print(error_msg)
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()
if no_fork_sock:
run_server(conf, logger, no_fork_sock, global_conf=global_conf)