Bug 406765

Summary: Disappearing connections
Product: [Plasma] plasma-nm Reporter: Oleg Solovyov <mcpain>
Component: appletAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: normal CC: jgrulich, nate
Priority: NOR    
Version: 5.12.8   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.15.5
Sentry Crash Report:
Attachments: debug output
dbus-monitor output
plasma-nm debug output
patch adding my own debug output
no malta
complete log

Description Oleg Solovyov 2019-04-22 13:22:37 UTC
SUMMARY
When user connects to Wi-Fi and connection was not established for some reason (e.g. wrong password or cancelling connection process) the network can disappear from list of available connections.

STEPS TO REPRODUCE
1. Select connection
2. Provide a wrong password
3. Click "Connect"
4. Click "Disconnect" before password is asked

OBSERVED RESULT
Connection is lost, unable to select it from applet
if is not observed, try to repeat steps 3-4, it's rarely reproducible

EXPECTED RESULT
Connection is shown in list of available connections

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.0.8
KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.2
Comment 1 Jan Grulich 2019-04-23 06:11:00 UTC
I believe that's NM fault, this wasn't happening before, but since some recent NM version, after you disconnect a wireless connection, they will disappear for a while and appear again as a new scan is probably being performed.
Comment 2 Oleg Solovyov 2019-04-23 07:15:19 UTC
(In reply to Jan Grulich from comment #1)
> I believe that's NM fault

I don't. nmcli in such cases works fine and all disappearing connections appears in console.

> since some recent NM version, after you disconnect a wireless connection, they will disappear for a while

Okay, since which recent version?
Reproducible with both NetworkManager 1.16.0 and NetworkManager 1.8.9
Comment 3 Jan Grulich 2019-04-23 07:35:54 UTC
I'm pretty sure it's NM fault, but to be sure, please provide information as described here [1].  

[1] - https://techbase.kde.org/Projects/Solid/Plasma-nm#My_connection_in_the_applet_shows_wrong_information
Comment 4 Oleg Solovyov 2019-04-23 07:46:27 UTC
Created attachment 119577 [details]
debug output
Comment 5 Jan Grulich 2019-04-23 07:52:05 UTC
That's not the debug I wanted, read whole "My connection in the applet shows wrong information" section. You need to run dbus-monitor and restart plasmashell while enabling debug information for plasma-nm and reproducing the issue.
Comment 6 Oleg Solovyov 2019-04-23 07:56:11 UTC
Created attachment 119578 [details]
dbus-monitor output
Comment 7 Jan Grulich 2019-04-23 08:06:26 UTC
From the log I see that all access points disappeared from NM and they were added again (that's what I said at the beginning). Can you please attach log from plasmashell with enabled plasma-nm debug?
Comment 8 Oleg Solovyov 2019-04-23 08:08:08 UTC
Created attachment 119579 [details]
plasma-nm debug output
Comment 9 Oleg Solovyov 2019-04-23 08:08:51 UTC
Created attachment 119580 [details]
patch adding my own debug output
Comment 10 Jan Grulich 2019-04-23 08:24:23 UTC
Even plasmashell debug confirms what I said at the beginning, the networks are removed and added later again.
Comment 11 Oleg Solovyov 2019-04-23 08:39:29 UTC
Created attachment 119581 [details]
no malta

Wireless network "malta" has been added but there are no malta's in list of available connections.
Comment 12 Jan Grulich 2019-04-23 09:32:42 UTC
What is the output of "nmcli -f all device show your_wifi_device"?
Comment 13 Oleg Solovyov 2019-04-23 09:42:26 UTC
Created attachment 119583 [details]
complete log
Comment 14 Jan Grulich 2019-04-23 10:05:28 UTC
Everything seems to be correct, I don't really see why the "malta" connection is not visible in the applet. Is there any other "malta" connection? I mean is the same wireless network configured for two connections?

I'm afraid that I will not be able to fix this until I manage to reproduce it locally or at least at this moment I have no idea what other information you can provide.
Comment 15 Oleg Solovyov 2019-04-24 08:09:09 UTC
(In reply to Jan Grulich from comment #14)
> Everything seems to be correct, I don't really see why the "malta"
> connection is not visible in the applet. Is there any other "malta"
> connection? I mean is the same wireless network configured for two
> connections?
> 
> I'm afraid that I will not be able to fix this until I manage to reproduce
> it locally or at least at this moment I have no idea what other information
> you can provide.

NM is removing all networks (at least wireless ones) for a moment and adding them back for some reason.
It is reproducible if you clicked "Disconnect" button quick enough - before adding connections back.
Comment 16 Jan Grulich 2019-04-24 09:18:05 UTC
I can reproduce what you mentioned, but in your case one network is added back according to the log, but it's not visible in the applet, that's what I cannot reproduce.
Comment 17 Oleg Solovyov 2019-04-24 11:55:36 UTC
(In reply to Jan Grulich from comment #16)
> I can reproduce what you mentioned, but in your case one network is added
> back according to the log, but it's not visible in the applet, that's what I
> cannot reproduce.

Try with network without any stored info in NM
Comment 18 Oleg Solovyov 2019-04-24 12:08:05 UTC
(In reply to Jan Grulich from comment #16)
> I can reproduce what you mentioned, but in your case one network is added
> back according to the log, but it's not visible in the applet, that's what I
> cannot reproduce.

for some reason, AppletProxyModel::filterAcceptsRow filters it out, that's why it's not visible.

NetworkModelItem::itemType returns NetworkModelItem::UnavailableConnection because m_devicePath is empty at the moment.

That's what I completely figured out as reason why it happens.
I can't figure out how to fix this - maybe make connection available again if it can be associated with wireless network?
Comment 19 Jan Grulich 2019-04-24 12:48:34 UTC
What do you mean by "connection without any stored info in NM", do you mean creating a connection, but not saving it to NM (e.g. using AddConnectionUnsaved() from NM's DBus)? It shouldn't make any difference and I tried that now, still works as expected. It's weird that the device path is empty in your case, because I see that "addAvailableConnection()" is being called and that's where the device path is set.
Comment 20 Oleg Solovyov 2019-04-24 12:54:39 UTC
(In reply to Jan Grulich from comment #19)
> What do you mean by "connection without any stored info in NM", do you mean
> creating a connection
I mean "create a completely new connection
e.g. connect to a wireless network you never connected before". 

> It's weird that the device path is empty in your case, because
> I see that "addAvailableConnection()" is being called and
> that's where the device path is set.
But connection is still hidden as unavailable. Seems to be something wrong with filter invalidation. In my case, filter was not invalidated where it should be.
Comment 21 Oleg Solovyov 2019-04-24 13:50:23 UTC
https://phabricator.kde.org/D20788
Comment 22 Oleg Solovyov 2019-04-30 13:07:13 UTC
Git commit 4cb1e69c1a615523d82f7986b8437906017a8d2d by Oleg Solovyov.
Committed on 30/04/2019 at 13:06.
Pushed by osolovyov into branch 'Plasma/5.15'.

Reset model when there are new available connections

Summary:

NetworkManager will remove all connections (at least wireless) and then add them again.
When user creates a new connection and clicks "Disconnect" button before adding connections back, the one which user tried to connect to will disappear from list of available, and it will become impossible to reactivate it from applet.

Reviewers: jgrulich

Reviewed By: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D20788

M  +2    -0    libs/models/networkmodel.cpp

https://commits.kde.org/plasma-nm/4cb1e69c1a615523d82f7986b8437906017a8d2d