6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00

Fixed bug #24 : QA could hung when starting trace session

This commit is contained in:
Vlad Khorsun 2024-06-13 17:12:49 +03:00
parent 07f6218ea0
commit 79348425b5

View File

@ -1265,10 +1265,13 @@ def trace_thread(act: Action, b: Barrier, cfg: List[str], output: List[str], kee
role: User role role: User role
stop: Event used to stop the trace thread stop: Event used to stop the trace thread
""" """
connected = False
try:
with act.connect_server(encoding=encoding, encoding_errors=encoding_errors, with act.connect_server(encoding=encoding, encoding_errors=encoding_errors,
user=user, password=password) as srv: user=user, password=password) as srv:
output.append(srv.trace.start(config='\n'.join(cfg))) output.append(srv.trace.start(config='\n'.join(cfg)))
b.wait() b.wait()
connected = True
while not stop.is_set(): while not stop.is_set():
line = srv.readline_timed(1) line = srv.readline_timed(1)
if line is not TIMEOUT: if line is not TIMEOUT:
@ -1276,6 +1279,10 @@ def trace_thread(act: Action, b: Barrier, cfg: List[str], output: List[str], kee
stop.set() stop.set()
elif keep_log: elif keep_log:
output.append(line) output.append(line)
except:
if not connected:
b.wait()
raise
class TraceSession: class TraceSession:
"""Object to manage Firebird trace session. """Object to manage Firebird trace session.