mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
183 stars 115 forks source link

notification_area applet memory leaks if the tray icon is updated constently #1444

Closed rafameou closed 2 weeks ago

rafameou commented 2 weeks ago

Expected behaviour

No memory leaks.

Actual behaviour

mate-panel will memory leak really fast until no ram is left. Video showcasing the problem: https://www.youtube.com/watch?v=zjMsdzgMdvE

Steps to reproduce the behaviour

  1. Clone and compile runcat-tray
  2. Open runcat-tray while using mate-panel with the notification area applet.

runcat-tray will call app_indicator_set_icon every tick to update the tray icon, this will result in mate-panel memory leaking. I haven't tested with others apps and/or checked the notification area applet code yet.

MATE general version

MATE 1.28.2

Package version

mate.mate-panel 1.28.1

Linux Distribution

NixOS unstable 24.11.20240612.57d6973 (Vicuña) x86_64

Link to bugreport of your Distribution (requirement)

This issue doesn't seem to be distribution related, I will check on linux mint tomorrow and return results if necessary.

rafameou commented 2 weeks ago

Update on the distribution thing. This issue doesn't seem to happen in Linux Mint 21.3, MATE version 1.26.2. I will be checking Arch Linux shortly and edit this message with the results.

Edit: The issue occurs in Arch Linux, tested in EndeavourOS with Mate 1.28.2 (notification-area 1.28.0), however, in Arch Linux (and probably every distro except NixOS) the process notification-area-applet memory leak instead, with the same behaviour showed in the video, high cpu usage and memory leak.

In Linux Mint with MATE 1.26.2, the cpu usage is lower if not 0%.

Maybe it's something that was added between 1.28 and 1.26?

cwendling commented 2 weeks ago

OK confirmed, this is indeed a pretty bad notification-area bug, fixed in #1446 -- I can no longer see any leaks with this PR and runcat-tray[^1].

[^1]: Note that I had to patch it to build, because Debian dropped libappindicator a while ago… fortunately switching to libayatana-appindicator is fairly trivial: one include and one pkg-config name.

The issue occurs in Arch Linux, tested in EndeavourOS with Mate 1.28.2 (notification-area 1.28.0), however, in Arch Linux (and probably every distro except NixOS) the process notification-area-applet memory leak instead, with the same behaviour showed in the video, high cpu usage and memory leak.

Which component leaks depends on whether the notification-area applet was built as a library or external app (one needs it to be a library for e.g. experimental Wayland support).

Update on the distribution thing. This issue doesn't seem to happen in Linux Mint 21.3, MATE version 1.26.2. […]

[…]

In Linux Mint with MATE 1.26.2, the cpu usage is lower if not 0%.

Maybe it's something that was added between 1.28 and 1.26?

No, nothing related to this -- and this threw me off a bit at first. The difference you see is likely that on LM you had the StatusIndicator support disabled, leading to libappindicator falling back to a "standard" try item. This explains both RAM usage (the image is not even transferred on the wire, and there's no leak at the other end anyway), and lower CPU usage (the notification area actually doesn't do anything, it just displays whatever foreign X window it got asked to -- you'll however see that the runcat-tray process uses a bit more CPU in that case).

rafameou commented 2 weeks ago

Hello! I have tested your pull request by overlay patching using Nix, and it does fix the problem. Sorry for the mistake I made in the Linux Mint part, thanks for looking into the issue and explaining it.