path: root/src/osmo_gsm_tester/esme.py
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2017-07-20 22:41:22 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-07-20 22:51:52 +0200
commit91c75b38f122d2728f6b94568df6534ddf0ed0f8 (patch)
tree24b0292d2fe3021483e016aa7b8da2c7ab1e3e84 /src/osmo_gsm_tester/esme.py
parent4a22ac7d2c0b24dba1939760121381e83827aa57 (diff)
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
Diffstat (limited to 'src/osmo_gsm_tester/esme.py')
1 files changed, 2 insertions, 1 deletions
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 @@ class Esme(log.Origin):
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