summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-25 12:58:25 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-25 13:07:46 +0200
commit7423d2e58409029c1440ef91033b945fbe94c359 (patch)
tree4c055c29182b85318ba8c7d7248324598720b0fa
parente913e3719a450fff0498efef17b52ce1a9f5b447 (diff)
modem: Attempt fixing crash from Register() dbus method
Register() method returned today this error which is expected acording to ofono documentation API. In this case it probably happens because the modem internally starts registering at some point between the time Scan() is finished and we call Register(). In this case it is fine for us and we should just ignore the error. A helper method is added to check for this as so far it seems tricky to check error information coming from pydbus. I could not reproduce this issue locally so I could not test that the helper function is going to handle it correctly when it is triggered. That's why I added extra debug information to be able to fix it next time it is triggered. File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 489, in scan_cb_register dbus_op.Register() File "/usr/local/lib/python3.4/dist-packages/pydbus/proxy_method.py", line 75, in __call__ 0, timeout_to_glib(timeout), None).unpack() GLib.Error: g-io-error-quark: GDBus.Error:org.ofono.Error.InProgress: Operation already in progress (36) Change-Id: I58dda09416ee7328812431220fd3d239c5c2980a
-rw-r--r--src/osmo_gsm_tester/ofono_client.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/osmo_gsm_tester/ofono_client.py b/src/osmo_gsm_tester/ofono_client.py
index ed7e3e4..43aa091 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -139,6 +139,15 @@ def dbus_async_call(instance, proxymethod, *proxymethod_args,
0, timeout, cancellable,
_async_result_handler, user_data)
+def dbus_call_dismiss_error(log_obj, err_str, method):
+ try:
+ method()
+ except Exception as e:
+ if isinstance(e, GLib.Error) and err_str in e.domain:
+ log_obj.log('Dismissed Dbus method error: %r' % e)
+ return
+ raise log.Error('dbus_call_dismiss_error raised error %r' % e)
+
class ModemDbusInteraction(log.Origin):
'''Work around inconveniences specific to pydbus and ofono.
ofono adds and removes DBus interfaces and notifies about them.
@@ -463,7 +472,8 @@ class Modem(log.Origin):
return
self.log('Registering with the default network')
netreg = self.dbus.interface(I_NETREG)
- netreg.Register()
+ dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', netreg.Register)
+
def scan_cb_register(self, scanned_operators, mcc_mnc):
self.dbg('scanned operators: ', scanned_operators);
@@ -486,7 +496,7 @@ class Modem(log.Origin):
return
dbus_op = systembus_get(matching_op_path)
self.log('Registering with operator', matching_op_path, mcc_mnc)
- dbus_op.Register()
+ dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', dbus_op.Register)
def power_cycle(self):
'Power the modem and put it online, power cycle it if it was already on'