From 79348425b5612434469ab6251cd61927595d37c9 Mon Sep 17 00:00:00 2001 From: Vlad Khorsun Date: Thu, 13 Jun 2024 17:12:49 +0300 Subject: [PATCH] Fixed bug #24 : QA could hung when starting trace session --- src/firebird/qa/plugin.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/firebird/qa/plugin.py b/src/firebird/qa/plugin.py index 9b0d0f54..97e140f3 100644 --- a/src/firebird/qa/plugin.py +++ b/src/firebird/qa/plugin.py @@ -1265,17 +1265,24 @@ def trace_thread(act: Action, b: Barrier, cfg: List[str], output: List[str], kee role: User role stop: Event used to stop the trace thread """ - with act.connect_server(encoding=encoding, encoding_errors=encoding_errors, - user=user, password=password) as srv: - output.append(srv.trace.start(config='\n'.join(cfg))) - b.wait() - while not stop.is_set(): - line = srv.readline_timed(1) - if line is not TIMEOUT: - if not line: - stop.set() - elif keep_log: - output.append(line) + connected = False + try: + with act.connect_server(encoding=encoding, encoding_errors=encoding_errors, + user=user, password=password) as srv: + output.append(srv.trace.start(config='\n'.join(cfg))) + b.wait() + connected = True + while not stop.is_set(): + line = srv.readline_timed(1) + if line is not TIMEOUT: + if not line: + stop.set() + elif keep_log: + output.append(line) + except: + if not connected: + b.wait() + raise class TraceSession: """Object to manage Firebird trace session.