linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.49k stars 729 forks source link

Memory leak with caribou #9379

Open kneekoo opened 4 years ago

kneekoo commented 4 years ago
 * Cinnamon 4.4.8
 * Mint 19.3
 * 64-bit
 * Intel i5-4690K with Intel HD Graphics 4600, using Mesa 20.1.1 from kisak-mesa PPA

Issue 3.2 GB RAM taken by /usr/lib/caribou/caribou after a while it's been (opened and) closed.

Steps to reproduce

Expected behaviour Closing the virtual keyboard should also close its process and free the RAM.

Other information After I terminated the process, I started the virtual keyboard again and I didn't notice caribou among in the process list - and I toggled "All processes" and I also manually checked with htop and sudo ps ax. But I only had issues with caribou when I started the virtual keyboard, so I don't know what's really going on. I initially wanted to report this to Gnome, but then I made a desktop shortcut to the Virtual keyboard menu entry in the Cinnamon menu and I noticed its command line: dbus-send --print-reply --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.ToggleKeyboard

The interesting part is that both times this happened, the process ended up hogging the same amount of RAM: 3.2 GB.

Also, Disk read total is quite high (first incident, 12-day uptime). What can caribou possibly read off of my storage to that extent? caribou-cropped

kneekoo commented 4 years ago

The problem is still present with Linux Mint 20 and Cinnamon 4.6.6.

RAM usage this time: 3.5 GB.

kneekoo commented 4 years ago

2 days uptime, caribou still hogs 3.5 GB RAM in Mint 20 Cinnamon. A fix would be nice, so I don't have to remove the package.

BillFleming commented 3 years ago

I also have this on one of my arch systems. After leaving it on for a few days it was consuming over 5GB RAM. Cinnamon 4.8.2, Caribou 0.4.21+66+g14f5428-2

clefebvre commented 3 years ago

How do you reproduce exactly?

kneekoo commented 3 years ago

I simply used my PC for whatever I needed it for. I used Caribou to type minor stuff with my Air Mouse while sitting in bed.

The problem is no longer present with Mint 20.1 (caribou 0.4.21+mint1+ulyssa), but I can't tell if 19.x and 20.0 still have it, as I upgraded.

clefebvre commented 3 years ago

Weird.. we did fix bugs in caribou but none of them related to memory management.

BillFleming commented 3 years ago

I don't have to do anything other than leave the PC on for a few days/weeks without restarting. Just today after 11 days uptime I see that Caribou was using 5.1GB RAM on a 64GB RAM system. Maybe if this will take a while to fix we can make a systemd task that will kill the program when it goes over X amount of memory. 500MB? Or if you are using earlyoom and have limited RAM you can add to /etc/default/earlyoom: EARLYOOM_ARGS="-r 3600 -n --avoid '(^|/)(init|systemd|Xorg|sshd|qemu-system-x86_64)$' --prefer '(^|/)(Web|waterfox-g3|brave|chromium|ksysguard|caribou)$'"

However I just noticed that when I re-open the virtual keyboard it doesn't start the caribou process again. Maybe caribou only needs to run once at bootup? Then after you login to a cinnamon session it is no longer needed? I never installed any other virtual keyboard software.

Version installed:

$ yay caribou 1 community/caribou 0.4.21+66+g14f5428-3 (186.1 KiB 982.0 KiB) (Installed) A text entry and UI navigation application (on-screen keyboard)

rmunn commented 1 year ago

Also seeing this, doing nothing but leaving the laptop on for two months.

rmunn@laptop:/dev/shm$ ps auxw
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
rmunn       3338  0.3  4.0 3503824 2629636 ?     Sl   Mar07 283:30 /usr/lib/caribou/caribou
...
rmunn@laptop:/dev/shm$ date
Sat May  6 10:18:42 AM EDT 2023

This laptop has 64GiB of RAM, and 4% of that is being used by the caribou process: 3.34GiB of virtual memory, including 2.51GiB of actual RAM allocated.

The fact that someone is experiencing this on Arch (https://github.com/linuxmint/cinnamon/issues/9379#issuecomment-753424551) suggests that it might be a Caribou issue and not Mint per se, though.

rmunn commented 1 year ago

The problem is no longer present with Mint 20.1 (caribou 0.4.21+mint1+ulyssa), but I can't tell if 19.x and 20.0 still have it, as I upgraded.

I am using Mint 21 with caribou version 0.4.21+mint4+vanessa and I'm seeing the memory leak. I'll try installing the caribou package from caribou 0.4.21+mint1+ulyssa and report back later if it fixes the issue.

rmunn commented 1 year ago

In https://github.com/linuxmint/cinnamon/issues/9379#issuecomment-779187071, Clement Lefebvre wrote:

How do you reproduce exactly?

I don't know exactly what I do; I certainly don't use the on-screen keyboard very often. Occasionally I use it to log in: my laptop keyboard has a couple of sticky keys that sometimes fail, and one of them is in my password. Usually I plug in a USB keyboard, but occasionally I click on the on-screen keyboard at the login prompt, so Caribou is in use then. But I've only done that two or three times in the past month, yet the process is using 2.5GiB of RAM.

There are two other things I can think of that might, emphasis on might, be triggers for this memory leak. One is suspending and resuming the computer: this is my main laptop, so I take it to the office and take it home every weekday. That's at least 10 suspends-and-resumes per week. The other is that I use four workspaces and routinely switch between them with Ctrl+Alt+Left/Right arrow keys. It's just barely possible that switching workspaces is causing Caribou to allocate some object that it never releases. If so, then only people who (like me) routinely use multiple workspaces would run into the issue.

rmunn commented 1 year ago

Just had caribou grow to nearly 18 GB of virtual memory usage (about 14 GB of RAM and 4 GB of swap) in three months of laptop usage:

rmunn@localhost:~$ ps auxw | grep caribou
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
rmunn       2497  0.4 21.0 17897280 13816316 ?   Sl   Jul05 176:52 /usr/lib/caribou/caribou

Output of free before and after killing process 2497:

rmunn@localhost:~$ free --mega
               total        used        free      shared  buff/cache   available
Mem:           67170       28569        3251       22560       35349       15291
Swap:          17179       13456        3723
rmunn@localhost:~$ kill 2497
rmunn@localhost:~$ free --mega
               total        used        free      shared  buff/cache   available
Mem:           67170       14140       17676       22563       35352       29717
Swap:          17179        9590        7588

While searching for any upstream bug reports, I noticed that https://wiki.gnome.org/Projects/Caribou says that "The GNOME Shell onscreen keyboard does not use Caribou anymore" and "Caribou is not under active development anymore." So I'm going to work around this by removing /etc/xdg/autostart/caribou-autostart.desktop so caribou will no longer be autostarted. If that works, I'll go on to remove the entire caribou package and be done with it.

bbbbbr commented 8 months ago

Adding another data point: Caribou memory usage sometimes grows to about 500+ MB of RAM after a few months of uptime without any active use of the application.

Linux Mint 21.1 Cinnamon, caribou version 0.4.21+mint4+vanessa

Since I don't use the application I'll take the course of the commenter above and disable it on startup.

will-hinson commented 6 months ago

I'm experiencing the same issue with Cinnamon on Arch Linux. /usr/lib/caribou was using 7.7 GB of RAM after 4 days of uptime.

Removing /etc/xdg/autostart/caribou-autostart.desktop as suggested above seems to have resolved the issue.

Cinnamon version: 6.0.4 Caribou version: 0.4.21+75+g8ad9883-5 Kernel version: 6.6.9-arch1-1

rmunn commented 6 months ago

I expect this will solve itself once Mint 22 comes out, because caribou was removed from Ubuntu's default-installed packages in, IIRC, Ubuntu 22.10. And as I mentioned earlier, the GNOME project no longer uses caribou, so it's highly unlikely that anyone will end up with caribou installed unless they specifically want it and went looking for it. So once Mint 22 is released based on Ubuntu 24.04, this memory leak will stop happening to nearly everyone, and only those who go out of their way to install caribou will experience it.

kneekoo commented 6 months ago

While that's good news, both people who continue using Mint 20.x (supported until April 2025) and 21.x (supported until April 2027) will remain affected. This will remain an issue for a while longer.

rmunn commented 6 months ago

While that's good news, both people who continue using Mint 20.x (supported until April 2025) and 21.x (supported until April 2027) will remain affected. This will remain an issue for a while longer.

Then this issue should probably stay open until April 2027, so that people running Mint 21.x have a chance of finding the workaround (remove /etc/xdg/autostart/caribou-autostart.desktop so caribou no longer auto-starts).