[MERGED] osmo-gsm-tester[master]: event_loop: Avoid leaking active timeouts on poll exception

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Sat Apr 7 16:07:45 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: event_loop: Avoid leaking active timeouts on poll exception
......................................................................


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
---
M src/osmo_gsm_tester/event_loop.py
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
         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

-- 
To view, visit https://gerrit.osmocom.org/7662
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c93cd67b2b83c0ecee96fbc6c4200b419bdf73f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list