GNOME Bugzilla – Bug 750261
Memory leak when WIFI WPA2 personal password dialog opens
Last modified: 2020-11-12 14:31:15 UTC
nm-applet has a memory leak that appears when the password dialog for a stored SSID is being opened. The memory consumption increases by about 8-10 MB every time the dialog is opened but is never released. When using nm-applet on a mobile computer the process' memory consumption may exceed 500 MB after serveral days (reconnecting to WIFI networks). Reproduce: 1. Add a WPA2 personal connection and do not store the password and then try to connect to that network or try to directly connect to a non-hidden WPA2 network 2. Observe the memory before and after attempting to connect When there's a WIFI network with stored credentials, the memory does not increase that much when connecting to such a network. So I think this must be related to that dialog or to the fact that the applet failed to ask the wallet for the credentials. There's also a downstream bug at Fedora including "smap" outputs: https://bugzilla.redhat.com/show_bug.cgi?id=1128766 The Git commit the package was build with is 36c8684 basing on the 0.9.10.2 tag. The leak also appears in Ubuntu's network-manager-applet 0.9.10.1 package.
The leak is also easily reproducible on current master. I could not find the reason, but it seems to me that src/libnma/nma-wifi-dialog.c is not the culprit and that the created NMAWifiDialog gets properly destroyed.
The wifi dialog calls ws_dynamic_wep_new() and ws_wpa_eap_new() which build a new WirelessSecurity object and related widgets. These functions call ws_802_1x_auth_combo_init() to instantiate EAP methods and some of them take a circular reference to WirelessSecurity, which prevents the destruction of the object. This seems to be the biggest leak. But those references were added in eeb2430b933e9 ("libnm-gtk: fix use-after-free of 802.1x usernames/passwords") to fix a crash, so at the moment it's not clear to me how to fix this.
Branch bg/wireless-security-leaks-bgo750261 solves most of the leaks. The remaining ones seems to be caused by GtkFileChooser instances leaking resources when the GtkBuilder created by EAP methods is destroyed.
Created attachment 342426 [details] Massif snapshot Snapshot of heap usage created with massif after the wifi dialog has been closed.
(In reply to Beniamino Galvani from comment #3) > Branch bg/wireless-security-leaks-bgo750261 solves most of the leaks. The > remaining ones seems to be caused by GtkFileChooser instances leaking > resources when the GtkBuilder created by EAP methods is destroyed. lgtm
Merged: https://git.gnome.org/browse/network-manager-applet/commit/?id=2ab0d34497cabe35a350ee72c46266c8046fffea Keeping the bug open for the remaining leak, which needs more investigation.
*** Bug 698809 has been marked as a duplicate of this bug. ***
bugzilla.gnome.org is being shut down in favor of a GitLab instance. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).