summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/event_loop.py
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-04-07 17:26:43 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-04-07 17:27:54 +0200
commitb6ab1da0af08dae1a9f7382532e42975f5633d84 (patch)
tree5c56ebefce1c4044d59a7ca757d98f30fdbc315a /src/osmo_gsm_tester/event_loop.py
parentc490cdeebdd43a1777c16f3f1f272df815b9c6cf (diff)
event_loop: Avoid leaking active timeouts on poll exception
It was spotted that when an error ocurred during poll generating an exception to finish the test (osmo-msc ended prematurely), then the active wait() condition was kept being checked for later tests, making all followup tests fail. That's because in case of exception we were not making sure the timeout is removed and it kept firing forever. Change-Id: I5c93cd67b2b83c0ecee96fbc6c4200b419bdf73f
Diffstat (limited to 'src/osmo_gsm_tester/event_loop.py')
-rw-r--r--src/osmo_gsm_tester/event_loop.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/osmo_gsm_tester/event_loop.py b/src/osmo_gsm_tester/event_loop.py
index a9683dd..64a110d 100644
--- a/src/osmo_gsm_tester/event_loop.py
+++ b/src/osmo_gsm_tester/event_loop.py
@@ -96,7 +96,11 @@ class EventLoop:
wait_req = WaitRequest(condition, condition_args, condition_kwargs, timeout, timestep)
wait_id = GObject.timeout_add(timestep*1000, self._trigger_cb_func, wait_req.condition_check)
while True:
- self.poll(may_block=True)
+ try:
+ self.poll(may_block=True)
+ except Exception: # cleanup of temporary resources in the wait scope
+ GObject.source_remove(wait_id)
+ raise
if wait_req.condition_ack or wait_req.timeout_ack:
GObject.source_remove(wait_id)
success = wait_req.condition_ack