[PATCH] osmo-gsm-tester[master]: modem: Attempt fixing crash from Register() dbus method

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 Aug 25 11:09:03 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3677

to look at the new patch set (#2).

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
---
M src/osmo_gsm_tester/ofono_client.py
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/77/3677/2

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

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

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



More information about the gerrit-log mailing list