[MERGED] osmo-gsm-tester[master]: esme: Fix race condition waiting for message response

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
Fri Jul 21 08:38:48 UTC 2017


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

Change subject: esme: Fix race condition waiting for message response
......................................................................


esme: Fix race condition waiting for message response

Sometimes in test esme_ms_sms_transaction.py we get the following error:
esme_ms_sms_transaction.py:54: ERR: ValueError: list.remove(x): x not in list

This appears due to a race condition because sms_send is used several times,
which means we don't wait or sync until we receive the response before calling
sms_send_wait_resp. That means when we wait for response of message with
seqnum X, we may receive response from message seqnum X-1 which was
initiated by sms_send and thus was not stored in the self.pdus_pending
array. As it's not there, trying to remove it triggers an exception.

Change-Id: Idf49f40eb46be1448b328a5c338ddbc4547148ff
---
M src/osmo_gsm_tester/esme.py
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/osmo_gsm_tester/esme.py b/src/osmo_gsm_tester/esme.py
index ff403c0..89eaa39 100644
--- a/src/osmo_gsm_tester/esme.py
+++ b/src/osmo_gsm_tester/esme.py
@@ -165,7 +165,8 @@
 
     def _process_pdus_pending(self, pdu, **kwargs):
         self.dbg('message sent resp with seq', pdu.sequence, ', pdus_pending:', self.pdus_pending)
-        self.pdus_pending.remove(pdu.sequence)
+        if pdu.sequence in self.pdus_pending:
+            self.pdus_pending.remove(pdu.sequence)
 
     def sms_send_wait_resp(self, sms_obj, mode, receipt=False):
         old_func = self.client.message_sent_handler

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf49f40eb46be1448b328a5c338ddbc4547148ff
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