Comment 86 for bug 1480877

Revision history for this message
Tony Espy (awe) wrote :

Some more details:

 - the version of the qtbase package in touch atm is: 5.4.1+dfsg-2ubuntu10

- I checked and didn't see significant differences in the networkmanager bearer plugin when comparing against 5.5.1, and 5.6.

- That said, there's been quite a few changes in the QDBus code, specifically qdbusintegrator.cpp. Some of the changes include modifications to the signal connect/disconnect code.

- After some further instrumentation, I *think* I've located the bug. I added more debug logging to the QDBus code, so I see when match rules are added and removed, and when the corresponding connect/disconnect calls are made. What I see is that the bearer plugin is calling DBusConnection::connect() for each AccessPoint object that's added. This results in a single match rule being added, however I see a second call to DBusConnection::connect() for the same object path, which cause the ref count to incremented. When the AccessPoint is removed, disconnect() only gets called once, the ref count is decremented, and the match rule lives on.

 - I originally thought this was due to the fact that QNetworkManagerEngine::nmRegistered() calls managerInterface->setConnections(), but at a closer the look the former is registering for Qt signals, while the latter registers for the associated DBus signals.

 - Looking at the constructor of the plugin engine, QNetworkManagerEngine, it connects the serviceRegistered Qt signal to the method nmEnabled(). At the end of the same function, it checks if the service (NM) has already been registered, and if so invokes nmRegistered again via invokeMethod ( that's some Voodoo I don't quite grok ). Looking at the nmRegistered() function, it has a guard which looks like it was copied from ofonoRegisted() as it guards against ofonoManager != NULL, not managerInterface ( which is what gets created in nmRegistered ). I'll add a bit more logging to confirm, but pretty sure this is the cause of the extra match refs, as if nmRegistered() is called twice, it'll cause connect() to be called for AccessPoint objects twice.

 - I also see twice as many "GetAll" method calls sent for each access point, although I haven't dug into why this is so yet...