Skip to content

Commit 7934842

Browse files
committed
Fixed bug #24 : QA could hung when starting trace session
1 parent 07f6218 commit 7934842

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/firebird/qa/plugin.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -1265,17 +1265,24 @@ def trace_thread(act: Action, b: Barrier, cfg: List[str], output: List[str], kee
12651265
role: User role
12661266
stop: Event used to stop the trace thread
12671267
"""
1268-
with act.connect_server(encoding=encoding, encoding_errors=encoding_errors,
1269-
user=user, password=password) as srv:
1270-
output.append(srv.trace.start(config='\n'.join(cfg)))
1271-
b.wait()
1272-
while not stop.is_set():
1273-
line = srv.readline_timed(1)
1274-
if line is not TIMEOUT:
1275-
if not line:
1276-
stop.set()
1277-
elif keep_log:
1278-
output.append(line)
1268+
connected = False
1269+
try:
1270+
with act.connect_server(encoding=encoding, encoding_errors=encoding_errors,
1271+
user=user, password=password) as srv:
1272+
output.append(srv.trace.start(config='\n'.join(cfg)))
1273+
b.wait()
1274+
connected = True
1275+
while not stop.is_set():
1276+
line = srv.readline_timed(1)
1277+
if line is not TIMEOUT:
1278+
if not line:
1279+
stop.set()
1280+
elif keep_log:
1281+
output.append(line)
1282+
except:
1283+
if not connected:
1284+
b.wait()
1285+
raise
12791286

12801287
class TraceSession:
12811288
"""Object to manage Firebird trace session.

0 commit comments

Comments
 (0)