[TOPBLOCKER] com.ubuntu.connectivity1.NetworkingStatus.Status is always online

Bug #1386109 reported by Albert Astals Cid on 2014-10-27
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Network Menu
Invalid
High
Jussi Pakkanen
Telegram app
High
Michał Karnicki
network-manager (Ubuntu RTM)
Critical
Mathieu Trudel-Lapierre

Bug Description

qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status

always returns "online" on the phone, no matter if i'm connected to wifi or not or in Flight mode or not.

known duplicate with different end result: bug #1383357

summary: - Status is always online
+ com.ubuntu.connectivity1.NetworkingStatus.Status is always online

This is a serious issue for any app using this API.

Changed in indicator-network:
status: New → Confirmed
Changed in libqtelegram:
status: New → Confirmed
importance: Undecided → High
Dan Chapman  (dpniel) on 2014-10-27
Changed in dekko:
status: New → Confirmed
Antti Kaijanmäki (kaijanmaki) wrote :

jikes..

Changed in indicator-network:
importance: Undecided → High
tags: added: 2014-10-30 rtm14
Changed in indicator-network:
assignee: nobody → Jussi Pakkanen (jpakkane)
Jussi Pakkanen (jpakkane) wrote :

On today's krillin (#137)

phablet@ubuntu-phablet:~$ qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
online

and then after enabling flight mode:

phablet@ubuntu-phablet:~$ qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
offline

Michał Karnicki (karni) wrote :

Will check now.

Albert Astals Cid (aacid) wrote :

Not here, i still get online wathever the state i try wifi connected or not + flight mode enabled or not

Michał Karnicki (karni) wrote :

What Albert said.

property bool isOnline: NetworkingStatus.online

from Ubuntu.Connectivity 1.0

returns true regardless of which setting (flight mode / wifi) I toggle.

The only state when it reports false is when I turn on Wi-Fi and it *is connecting* -- during that short period, it reports false.

Michał Karnicki (karni) wrote :

I think flight mode isn't very reliable. I'm now toggling flight mode off and on (not fast), and the icon won't go away, while wifi is indicated as "turned on" all the time. I'm in flightmode and my wifi is working.. krillin #137.

Albert Astals Cid (aacid) wrote :

So what i found is that you need to somehow prod networkmanager, that is, i can disable wifi and wait for minutes and be in this situation

phablet@ubuntu-phablet:/var/crash$ ifconfig
lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:9062 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9062 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2546884 (2.5 MB) TX bytes:2546884 (2.5 MB)

phablet@ubuntu-phablet:/var/crash$ qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
online

then if i call nmcli the status changes immediately

phablet@ubuntu-phablet:/var/crash$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running disconnected enabled disabled enabled disabled
phablet@ubuntu-phablet:/var/crash$ qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
offline

Jussi Pakkanen (jpakkane) wrote :

Indicator-network's online status only reports what networkmanager tells it. There is no actual logic there. Since poking networkmanager seems to fix the issue this seems to indicate that the issue is in networkmanager and not indicator-network.

Jussi Pakkanen (jpakkane) wrote :

Albert: since you can make this happen, could you please test when NetworkManager sends its state signal. To do that use dbus-monitor to check the signals that get sent out.

Address: org.freedesktop.NetworkManager
Object: /org/freedesktop/NetworkManager
Interface: org.freedesktop.NetworkManager
Signal: StateChanged

The list of values is documented here: https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_STATE

Thanks,

Albert Astals Cid (aacid) wrote :
Download full text (3.1 KiB)

So this is what i get after toggling off the wifi switch on the UI

Lots of with different XYZ
signal sender=:1.8 -> dest=(null destination) serial=87524 path=/org/freedesktop/NetworkManager/Devices/4; interface=org.freedesktop.NetworkManager.Device.Wireless; member=AccessPointRemoved
   object path "/org/freedesktop/NetworkManager/AccessPoint/XYZ"

signal sender=:1.8 -> dest=(null destination) serial=87550 path=/org/freedesktop/NetworkManager/Devices/4; interface=org.freedesktop.NetworkManager.Device; member=StateChanged
   uint32 10
   uint32 100
   uint32 36

signal sender=:1.8 -> dest=(null destination) serial=87611 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=DeviceRemoved
   object path "/org/freedesktop/NetworkManager/Devices/4"

signal sender=:1.8 -> dest=(null destination) serial=87617 path=/org/freedesktop/NetworkManager/ActiveConnection/2; interface=org.freedesktop.NetworkManager.Connection.Active; member=PropertiesChanged
   array [
      dict entry(
         string "Default"
         variant boolean false
      )
      dict entry(
         string "State"
         variant uint32 4
      )
      dict entry(
         string "Devices"
         variant array [
            ]
      )
   ]

signal sender=:1.8 -> dest=(null destination) serial=87618 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged
   array [
      dict entry(
         string "PrimaryConnection"
         variant object path "/"
      )
      dict entry(
         string "WirelessEnabled"
         variant boolean true
      )
      dict entry(
         string "PrimaryConnectionType"
         variant string ""
      )
      dict entry(
         string "ActiveConnections"
         variant array [
               object path "/org/freedesktop/NetworkManager/ActiveConnection/2"
            ]
      )
   ]

signal sender=:1.8 -> dest=(null destination) serial=87619 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged
   array [
      dict entry(
         string "ActiveConnections"
         variant array [
            ]
      )
   ]

signal sender=:1.8 -> dest=(null destination) serial=87628 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged
   array [
      dict entry(
         string "WirelessEnabled"
         variant boolean false
      )
   ]

and this is what i get after calling nmcli nm on a different terminal

signal sender=:1.8 -> dest=(null destination) serial=87631 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=StateChanged
   uint32 20

signal sender=:1.8 -> dest=(null destination) serial=87633 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged
   array [
      dict entry(
         string "State"
         variant uint32 20
      )
   ]

So it really seems something in networkmanager is forgetting to send the StateChanged for org.freedesktop.NetworkManager ...

Read more...

Changed in network-manager (Ubuntu):
status: New → Confirmed
Changed in indicator-network:
status: Confirmed → Invalid

Please reproduce this and add debug logs for NetworkManager; see http://wiki.ubuntu.com/DebuggingNetworkManager for how to do this.

Changed in network-manager (Ubuntu):
status: Confirmed → Incomplete

Once the logs are available, it will be easier to make sure that this is what is happening; but in short, it looks like when the wifi device is deactivated from the UI, the wifi disable call to Urfkill removes the device before it has any time to signal a change in device state, which would make it impossible for NM right now to know about that device state change, and thus to update the global state.

Albert Astals Cid (aacid) wrote :

Here the requested log

Changed in network-manager (Ubuntu):
status: Incomplete → Confirmed

At this point there is not much to do: the device is getting removed and NM sees only the state change to unmanaged, since we're dealing with hybris-only devices in this particular case: this wouldn't happen with a traditional rfkill device. There's also other code that deals with unmanaged devices to let NM be online in that case, since that's important on desktops which may have network devices configured manually, outside of NetworkManager.

I'm going to try forcing a state update at the end of the urfkill state change handlers, see if that is sufficient as a workaround, but past that there won't be another place to hook into in order to update states.

Moreover, the connectivity API/indicator-network should be requesting a new state from NetworkManager when it gets asked for the state of the system, even if it's receiving the signals. This call always causes NM to re-check its internal state.

Albert Astals Cid (aacid) wrote :

Using RTM silo 16 this is fixed.

Michał Karnicki (karni) wrote :

"Can't publish: Some projects (urfkill) that were in the silo configuration list were not built"

I can't confirm. I'm on 14.09-proposed, I did:
  citrain host-upgrade 16 9999 ubuntu-rtm

and I'm getting
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I'm probably doing something wrong.

Albert Astals Cid (aacid) wrote :

Old school me just added

deb http://ppa.launchpad.net/ci-train-ppa-service/landing-016/ubuntu-rtm 14.09 main
deb-src http://ppa.launchpad.net/ci-train-ppa-service/landing-016/ubuntu-rtm 14.09 main

to apt sources and update+dist-upgrade

> citrain host-upgrade 16 9999 ubuntu-rtm

This should be

$ citrain device-upgrade 16 9999

I imagine.

$ citrain device-upgrade 16 9999 ubuntu-rtm

Correct, thank you Saviq.
It was sitting really long on phablet-writable-image, so I ended-up going Albert's route.

I confirm the problem is solved in silo 16.

I agree it may look fixed with silo 16 (and it likely helps), yet I can't reproduce the issue on image 140; without the updated package installed:

phablet@ubuntu-phablet:~$ apt-cache policy network-manager
network-manager:
  Installed: 0.9.8.8-0ubuntu29
  Candidate: 0.9.8.8-0ubuntu30
  Version table:
     0.9.8.8-0ubuntu30 0
        500 http://ppa.launchpad.net/ci-train-ppa-service/landing-016/ubuntu-rtm/ 14.09/main armhf Packages
 *** 0.9.8.8-0ubuntu29 0
        500 http://derived.archive.canonical.com/ubuntu-rtm/ 14.09/main armhf Packages
        100 /var/lib/dpkg/status

qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
always returns proper status on my device.

indicator-network armhf 0.5.1+14.10.20141030~rtm-0ubuntu1

fixes the issue; the new upload with rebuild against the new dbus-cpp seems to fix the problem sufficiently: the qdbus command now tracks the right global state properly.

scratch that, re-applying the update I can again reproduce the bug. indicator-network helps but is not the full solution.

Michał Karnicki (karni) wrote :

I'm on 140 (clean flash) and it's not the case here (regarding comment #21).

y1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status/connectivit
online

> disabled wi-fi (only connection)

y1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status/connectivit
online

> enabled flight mode

y1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status/connectivit
online

phablet@ubuntu-phablet:~$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running disconnected enabled disabled enabled disabled

y1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status/connectivit
offline

Confirming, network-manager 0.9.8.0-0ubuntu30 fixes the issue; I'm marking it as tested on image 140.

Changed in network-manager (Ubuntu):
importance: Undecided → Medium
status: Confirmed → In Progress
assignee: nobody → Mathieu Trudel-Lapierre (mathieu-tl)
Michał Karnicki (karni) wrote :

I'm sorry, I shoud have noted I ineed was testing this on 140, but with ubuntu39 package:

phablet@ubuntu-phablet:~$ apt-cache policy network-manager
network-manager:
  Installed: 0.9.8.8-0ubuntu29
  Candidate: 0.9.8.8-0ubuntu29
  Version table:
 *** 0.9.8.8-0ubuntu29 0
        500 http://derived.archive.canonical.com/ubuntu-rtm/ 14.09/main armhf Packages
        100 /var/lib/dpkg/status

Olli Ries (ories) on 2014-11-03
summary: - com.ubuntu.connectivity1.NetworkingStatus.Status is always online
+ [TOPBLOCKER] com.ubuntu.connectivity1.NetworkingStatus.Status is always
+ online
tags: added: 2014-11-06
removed: 2014-10-30

There are still some cases after toggling flight mode where the state remains Online. Can anyone else reproduce this?

The major issue here is that the driver is sending back bad states to NetworkManager because it's being toggled via libhybris -- it's then up to whatever in which order things are done: removing the rfkill interface, removing the interface itself, etc. NM can hardly cope with this, because we still have to account for the fact that some devices may be unmanaged due to being handled outside of NM, in which case they need to be considered online. This is currently why we're seeing the online state in some cases where we'd expect it to be offline.

Since as it was shown previously; any call to nmcli (dev or nm) updates the state properly, it seems to be like it would be a proper fix to have in indicator-network as well to check with NM what the state should be when it's requested by apps.

Albert Astals Cid (aacid) wrote :

The thing is that status is not requested by apps, apps have a QML binding to that value and it's the value that should change itself and send a signal, otherwise you're going to end up with polling.

Antti Kaijanmäki (kaijanmaki) wrote :

inheriting priority from bug #1383357

description: updated
Changed in network-manager (Ubuntu):
importance: Medium → Critical
affects: network-manager (Ubuntu) → network-manager (Ubuntu RTM)
Changed in network-manager (Ubuntu RTM):
status: In Progress → Fix Committed
Michał Karnicki (karni) wrote :

I confirm, thank you!

Changed in libqtelegram:
milestone: none → m8
status: Confirmed → Fix Released
Michał Karnicki (karni) on 2014-11-06
Changed in libqtelegram:
assignee: nobody → Michał Karnicki (karni)
Changed in network-manager (Ubuntu RTM):
status: Fix Committed → Fix Released
Olli Ries (ories) on 2014-11-10
Changed in dekko:
status: Confirmed → Opinion
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments