When toggling flight mode rapidly, cellular state gets stuck

Bug #1339794 reported by Martti Piirainen on 2014-07-09
This bug affects 2 people
Affects Status Importance Assigned to Milestone
urfkill (Ubuntu)
Tony Espy
urfkill (Ubuntu RTM)
Tony Espy

Bug Description

Test steps:
 - Open network settings
 - Observe status of cellular modem (for example, via /usr/share/ofono/scripts/monitor-ofono), especially the org.ofono.Modem.Online property
 - Enable flight mode via UI switch
 - Disable flight mode via UI switch
 - Repeat rapidly several times (ca. once per second)
Actual result: After a few toggles, the cellular modem status is not changed anymore (the UI switch status does change)
Expected result:
 - UI status and cellular modem status are always synchronized
 - Maybe disable (gray out) the UI switch during state changes

Tested on mako HW, with silo 14 (ppa:ci-train-ppa-service/landing-014) which currently contains these packages:
  connectivity-api 0.0.1+14.10.20140709.2-0ubuntu1
  dbus-cpp 3.0.0+14.10.20140709.2-0ubuntu1
  indicator-network 0.5.1+14.10.20140709.2-0ubuntu1
  ubuntu-system-settings 0.3+14.10.20140709.2-0ubuntu1
  urfkill 0.6.0~20140708.110711.a0581f3-0ubuntu1~mtrudel1

Tony Espy (awe) wrote :

I've confirmed that this isn't an issue with urfkill.

The scenario I ran was to open a window and run the ofono-monitor script:

$ adb shell /usr/share/ofono/scripts/monitor-ofono

...and then in another terminal use the urfkill flight-mode switch to toggle the modem on/off/on/off...

The output of monitor-ofono looks fine to me and the modem is continuously toggled Online/Offline/...

Changed in indicator-network (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Tony Espy (awe) wrote :

OK, please disregard my previous comment.

I found it easier to reproduce this bug from system settings vs. the network indicator as I can just toggle the switch without having to open the menu again to toggle the next time.

I was able to reproduce the problem you describe, but the culprit appears to be urfkill and not the indicator/settings code.

Eventually the I managed to get the phone in a state where Flight-Mode was disabled, however the modem was offline:

espy@shrike:% adb shell /usr/share/urfkill/scripts/flight-mode
flight-mode is: 0
espy@shrike:% adb shell /usr/share/ofono/scripts/list-modems | grep Online
    Online = 0

When I examine the syslog, I see the following errors reported:

Jul 9 17:56:54 ubuntu-phablet URfkill[936]: <warning> Could not set Online property in oFono: GDBus.Error:org.ofono.Error.InProgress: Operation already in progress

affects: indicator-network (Ubuntu) → urfkill (Ubuntu)

This does not cover retry logic, but I've modified the flight mode handling a bit so that we don't try to set the modem back to a saved state once flight mode is toggled off: in other words, when it's toggled rapidly, the modem should follow the requested flight mode state exactly.

Should the modem still fail to get online or offline; the flight mode switch can be toggled again to effectively do a "manual" retry.

The proposed fix is in my PPA: ppa:mathieu-tl/nv-build, as urfkill 0.6.0~20140708.110711.a0581f3-0ubuntu3~mtrudel1.

I would very much appreciate some careful testing to confirm at least part of the issue is covered.

Changed in urfkill (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Mathieu Trudel-Lapierre (mathieu-tl)

Let's use bug 1321627 for the issues with WWAN state is the Online operation fails in oFono.

This bug here will cover only the devices states when flight-mode is rapidly toggled.

There is no question, the two bugs are linked, but they need to be fixed independently.

Tony Espy (awe) wrote :

Testing urfkill - 0.6.0~20140708.110711.a0581f3-0ubuntu3~mtrudel1 on mako/#u132 + ofono - 1.12.bzr6870+14.10.20140717-0ubuntu1 from silo-015.

I'm still able to reproduce the problem, and actually in this case, it looks like all the devices ended-up in blocked state.

I rapidly toggled the FM switch on the main System Settings panel. At some point, the modem stopped responding, and never came back online.

So in summary of phone's state is:

1. FM toggle on main Settings page is off
2. ofono's 'list-modems' shows modem 'Online = 0' ( should be 'Online = 1' )
3. urfkill's 'flight-mode' script shows 'flight mode is: 0'
4. urfkill's 'enumerate' script shows all of the devices as 'soft=true'

See attached debug output for details. I will also attach a stripped down syslog from the same session.

Tony Espy (awe) wrote :

Also note that the output of 'rfkill list' shows both BT and Wi-Fi soft-blocked:

root@ubuntu-phablet:~# rfkill list
0: phy0: Wireless LAN
 Soft blocked: yes
 Hard blocked: no
1: hci0: Bluetooth
 Soft blocked: yes
 Hard blocked: no

Tony Espy (awe) wrote :

syslog from rfkill stress testing

Tony Espy (awe) wrote :

One last clue, here's the contents of /var/lib/urfkill/saved-states:

root@ubuntu-phablet:~# more /var/lib/urfkill/saved-states









Tony Espy (awe) wrote :

Finally, I was able to toggle flight-mode on and then off again and I did get the modem, Wi-Fi and BT unblocked, however the GPRS connection was not re-established. 'list-contexts' shows none active, and Cellular Settings shows Data off.

Martti Piirainen (piiramar) wrote :

FWIW, I can still fairly easily reproduce this in mako hw, image 171, by toggling ca. every 1-2 seconds (so not "super fast"). While in the error state, the overall flight mode state can still be toggled (incl. Bluetooth and WiFi radios), but the cellular modem stays offline and shows "soft=true" in /var/lib/urfkill/saved-states (and the WWAN setting is even preserved over reboot).

Tony Espy (awe) on 2014-08-11
Changed in urfkill (Ubuntu):
assignee: Mathieu Trudel-Lapierre (mathieu-tl) → Tony Espy (awe)
importance: High → Critical
Thomas Strehl (strehl-t) on 2014-08-13
tags: added: rtm14
Tony Espy (awe) on 2014-09-09
tags: added: touch-2014-09-18
Tony Espy (awe) wrote :

Updated milestone as landing the required fix requires additional fixes to indicator-network.

There also have been some krillin-specific timeout issues that have taken longer to debug than expected.

tags: added: touch-2014-09-25
removed: touch-2014-09-18
Tony Espy (awe) on 2014-09-29
Changed in urfkill (Ubuntu RTM):
importance: Undecided → Critical
assignee: nobody → Tony Espy (awe)
Changed in urfkill (Ubuntu):
status: In Progress → Fix Committed
Changed in urfkill (Ubuntu RTM):
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package urfkill - 0.6.0~20141007.235123.f908aff.1-0ubuntu1

urfkill (0.6.0~20141007.235123.f908aff.1-0ubuntu1) utopic; urgency=medium

  * New release snapshot:
    - Asynchronous support for rfkill operations. (LP: #1321627, #1339794)
    - Improvements to state persistence. (LP: #1354716)
    - Support for devices driven by libhybris rather than rfkill.
  * debian/patches/ignore_input_monitor_startup.patch: dropped, included
  * debian/control:
    - bump Build-Depends on libglib2.0-dev to >= 2.36 for GTask.
    - add a Build-Depends on libhybris-dev for hybris-driven devices support.
    - bump Standards-Version to 3.9.5.
  * debian/scripts/enumerate: handle the new hybris device type.
  * debian/rules: remove SysV init startup links.
 -- Mathieu Trudel-Lapierre <email address hidden> Tue, 07 Oct 2014 23:53:07 -0400

Changed in urfkill (Ubuntu RTM):
status: Fix Committed → Fix Released
Changed in urfkill (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers