Commit d51ca57a authored by Petr Špaček's avatar Petr Špaček

Merge branch 'kresd-exits' into 'master'

fixes for situations when a resolver exits (or hangs) at unforseen times

See merge request !145
parents 3a6824dd 35346bf2
Pipeline #43186 passed with stage
in 3 minutes and 7 seconds
......@@ -261,9 +261,13 @@ def run_daemon(cfg, environ):
def conncheck_daemon(process, cfg, sockfamily):
"""Wait until the server accepts TCP clients"""
sock = socket.socket(sockfamily, socket.SOCK_STREAM)
tstart = datetime.now()
while True:
time.sleep(0.1)
if process.poll():
if (datetime.now() - tstart).total_seconds() > 5:
raise RuntimeError("Server took too long to respond")
# Check if the process is running
if process.poll() is not None:
msg = 'process died "%s", logs in "%s"' % (cfg['name'], cfg['dir'])
logger = logging.getLogger('deckard.daemon_log.%s' % cfg['name'])
logger.critical(msg)
......
......@@ -754,6 +754,8 @@ class Step:
answer = None
if not self.data[0].is_raw_data_entry:
while True:
if (datetime.now() - tstart).total_seconds() > 5:
raise RuntimeError("Server took too long to respond")
try:
answer, _ = recvfrom_msg(sock, True)
break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment