cinnamon runaway memory problem

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

cinnamon runaway memory problem

Post by dhdurgee »

I am encountering a problem where cinnamon is running away with memory requiring me to restart it to get out of it. This running mint 20.1 x64 cinnamon with all current updates applied.

I don't know what is causing this problem. The last time this occurred I checked my system monitor which showed cinnamon using 6.4G of memory! It starts out using about 70M, so this is a huge memory runaway.

I don't know if this is the problem, but looking in ..xsession-errors I see many errors of the form:

Code: Select all

(cinnamon:1270): Cjs-CRITICAL **: 16:09:08.806: JS ERROR: Error: second argument to Lang.bind() must be a function, not undefined
bind@resource:///org/gnome/gjs/modules/script/lang.js:75:15
_sendNotification@/usr/share/cinnamon/js/ui/placesManager.js:169:61
_stopFinish@/usr/share/cinnamon/js/ui/placesManager.js:211:14
I currently have about 115k of these in there!

HELP!

Dave
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gittiest personITW
Level 12
Level 12
Posts: 4289
Joined: Tue May 28, 2019 4:27 pm

Re: cinnamon runaway memory problem

Post by gittiest personITW »

Run 'top' in Terminal and see what seems to be taking up resources.
Post back if it isn't a specific application and you need more help.
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

I will do so if it occurs again, which thus far it has not. Given the lack of other responses I take it this is not a common event with a known solution.

Dave
miragon
Level 1
Level 1
Posts: 16
Joined: Mon Apr 19, 2021 8:21 am

Re: cinnamon runaway memory problem

Post by miragon »

Just wanted to bump this, I'm running into similar problems about once or twice a day for some days now. Missed this topic and posted my issue at viewtopic.php?f=208&t=348748.
I can't confirm nor deny the memory as the reason for the freezing, as my machine is so unresponsive once it happens that I can't even bring up a terminal...
rickNS
Level 9
Level 9
Posts: 2914
Joined: Tue Jan 25, 2011 11:59 pm

Re: cinnamon runaway memory problem

Post by rickNS »

Cinnamon's memory leaks, no real fix, just a work around, that is to restart cinnamon.
Clem's blog post shows how to put a "cap" on cinnamon's memory usage (In version 5), and restart it automatically.
https://blog.linuxmint.com/?p=4037
We know there still are a few leaks out there because we hear of people who come back to their computer after days of it being idle to find their Cinnamon process using 2GB, 4GB, 6GB of RAM. We don’t know what cause these leaks yet but we’ll have a workaround in Cinnamon 5.0.
scroll down to the cinnamon improvements section.

Some flagship.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

I just had it happen again today. As soon as I noticed that used memory was at 92% and swap at 6% I restarted cinnamon from the troubleshoot menu. Used memory is at 22% but swap is only down to 5.7% now. Once again there are thousands of errors in ~/.xsession-errors and the file is now 18,409,103 bytes in size!

Looking in the ~/.xsession-errors show the problem starting at 15:05:55.051, so I took a look at my logs and see the following shortly before in syslog:

Code: Select all

May 10 15:05:52 Z560 systemd[1]: media-dhdurgee-a00f3691\x2dd97f\x2d4e54\x2d8b5d\x2dedd26b5bde48.mount: Succeeded.
May 10 15:05:52 Z560 udisksd[759]: udisks_mount_get_mount_path: assertion 'mount->type == UDISKS_MOUNT_TYPE_FILESYSTEM' failed
May 10 15:05:52 Z560 udisksd[759]: Cleaning up mount point /media/dhdurgee/a00f3691-d97f-4e54-8b5d-edd26b5bde48 (device 8:17 is not mounted)
May 10 15:05:52 Z560 systemd[1]: Stopping Clean the /media/dhdurgee/a00f3691-d97f-4e54-8b5d-edd26b5bde48 mount point...
May 10 15:05:52 Z560 systemd[1]: clean-mount-point@media-dhdurgee-a00f3691\x2dd97f\x2d4e54\x2d8b5d\x2dedd26b5bde48.service: Succeeded.
May 10 15:05:52 Z560 systemd[1]: Stopped Clean the /media/dhdurgee/a00f3691-d97f-4e54-8b5d-edd26b5bde48 mount point.
May 10 15:05:52 Z560 udisksd[759]: Unmounted /dev/sdb1 on behalf of uid 1000
May 10 15:05:52 Z560 systemd[1117]: media-dhdurgee-a00f3691\x2dd97f\x2d4e54\x2d8b5d\x2dedd26b5bde48.mount: Succeeded.
This was logged only three seconds before things went wacky, so perhaps this is related? The first error logged is:

Code: Select all

(cinnamon:1383): Cjs-CRITICAL **: 15:05:55.051: JS ERROR: Error: second argument to Lang.bind() must be a function, not undefined
bind@resource:///org/gnome/gjs/modules/script/lang.js:75:15
_sendNotification@/usr/share/cinnamon/js/ui/placesManager.js:169:61
_removeFinish@/usr/share/cinnamon/js/ui/placesManager.js:293:14
Any clues here?

Dave

PS: Just noticed the following in a terminal window that might be related:

Code: Select all

Gtk-WARNING **: 15:05:52.264: Failed to measure available space: Error getting filesystem info for /media/dhdurgee/a00f3691-d97f-4e54-8b5d-edd26b5bde48: No such file or directory
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

My experience yesterday lead me to inspect the log from back when the previous event occurred. I also see problems with a USB drive at that point as well. This leads me to speculate that it has something to do with an error while attempting to update display of the USB drive on the desktop. Does this match with other reported problems, or are they from a separate cause?

Dave
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

I have a few questions I hope someone here can answer. Seeing that the developers have seen fit to add automated restart for memory issues I would like to do so with the current release. First I would need to know where the file listing the cinnamon process ID is located. Then I would need to know the command used by the troubleshooting menu or the Ctl-Alt_Esc handler to restart cinnamon. Then I would need to know how to access the used memory as per the gnome-system-monitor. Looking at the process details it appears to start with the RSS as reflected by the ps command and then subtracts the shared memory. Can I get the shared memory from the ps command as well as the RSS somehow? If so, I have yet to find it.

Any pointers appreciated .

Dave
mikeflan
Level 16
Level 16
Posts: 6969
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: cinnamon runaway memory problem

Post by mikeflan »

Code: Select all

cinnamon --replace
There are five known ways to restart Cinnamon:
- Ctrl+Alt+Esc - for hotkey-inclined users
- Desktop/panel icon - for mouse-inclined users
- Dedicated button in applets/desklets/extensions/applications (i.e. Developer's Tools desklet by Stephen Collins)
- Right-click panel > Troubleshooting > Restart Cinnamon
- cinnamon --replace - for Terminal-inclined users
They are basically the same command issued in different ways.
mikeflan
Level 16
Level 16
Posts: 6969
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: cinnamon runaway memory problem

Post by mikeflan »

Then I would need to know how to access the used memory as per the gnome-system-monitor.
You are not doing much research on your own.

Code: Select all

free -m
or

Code: Select all

cat /proc/meminfo
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

mikeflan wrote: Sat May 15, 2021 7:51 pm
Then I would need to know how to access the used memory as per the gnome-system-monitor.
You are not doing much research on your own.

Code: Select all

free -m
or

Code: Select all

cat /proc/meminfo
Those give the totals for the system, I want to determine what cinnamon is using to determine if it needs to be restarted.

For example, right now opening the gnome system monitor and looking at the properties of the cinnamon process shows:

Memory 71.0 MiB
Resident Memory 155.9 Mib
Shared Memory 84.9 Mib

The ps command will give me the resident memory, but I don't see how to get the shared memory so I can determine the private memory.

In order to simplify things I will need the process ID as well, which I imagine is in a file somewhere to facilitate the restart process. I have thus far been unable to locate it. I can if necessary pull it from the ps display, but it would be nice to get it the same way the support utilities do.

This is a real problem, as before I restarted cinnamon this morning it was using 700 MiB!

Dave
mikeflan
Level 16
Level 16
Posts: 6969
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: cinnamon runaway memory problem

Post by mikeflan »

I believe you. I am afraid I am going to be learning more from you, than you from me.
I hope other smart people jump in.

My system monitor:
monitor.png
I happen to catch it in the microsecond that 'cinnamon-killer-daemon' is running. Normally it is sleeping. I'm wondering if it might be part of your problems.

And then my htop:
htop.png
bhe
Level 1
Level 1
Posts: 10
Joined: Thu Apr 11, 2019 4:21 pm

Re: cinnamon runaway memory problem

Post by bhe »

I also had this exact problem several times the last few days. Cinnamon was at 100% CPU and eventually using up all memory and swap making the system unresponsive.
dhdurgee wrote: Tue May 11, 2021 9:55 am My experience yesterday lead me to inspect the log from back when the previous event occurred. I also see problems with a USB drive at that point as well. This leads me to speculate that it has something to do with an error while attempting to update display of the USB drive on the desktop. Does this match with other reported problems, or are they from a separate cause?
Exactly this :!: I was upgrading from Mint 20 to 20.1, so I was making backups/running timeshift with an external harddisk. Both: Before and after the update.
bhe
Level 1
Level 1
Posts: 10
Joined: Thu Apr 11, 2019 4:21 pm

Re: cinnamon runaway memory problem

Post by bhe »

Actually I just found a bugreport describing this very issue. Unfortunately no solution yet.

https://github.com/linuxmint/cinnamon/issues/9926
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

bhe wrote: Sun May 16, 2021 4:58 pm Actually I just found a bugreport describing this very issue. Unfortunately no solution yet.

https://github.com/linuxmint/cinnamon/issues/9926
Sounds like the bug all right.

I am now working on a shell script to run in the background that keeps an eye on cinnamon's memory use which will restart it when it exceeds a defined memory threshold. I will post it here when I get it finished for anyone interested in using it.

Dave
gittiest personITW
Level 12
Level 12
Posts: 4289
Joined: Tue May 28, 2019 4:27 pm

Re: cinnamon runaway memory problem

Post by gittiest personITW »

I can't remember who put the following on the forums but thank you if you see this.
If you run this in Terminal it lists processes in text file every 2 seconds then cycles (so you don't end up with gigabyte size file) it into top-results.txt file.

Code: Select all

while true; do top -b -n 1 -w 256 | head -n 20 >> top-results.txt; sleep 2; done
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

Here is the script I am testing now. It has yet to need to restart cinnamon, so it has not yet proved itself:

Code: Select all

#!/bin/bash
#
# script to monitor and restart cinnamon when it gobbles memory
#
 MAX_RSS=360448  # 352MiB threshold for RSS
 SLEEP_TIME=60   # time between memory checks
#
 echo 'MAX_RSS='$MAX_RSS
 echo 'SLEEP_TIME='$SLEEP_TIME
 while true
  do
   sleep $SLEEP_TIME
   CIN_RSS=`ps -C cinnamon -o rss h`
   echo 'CIN_RSS='$CIN_RSS
   if [ $CIN_RSS -gt $MAX_RSS ]
    then
     echo 'restarting cinnamon'
     RC=`cinnamon --replace &`
     echo 'RC='$RC
   fi
  done
# hopefully this does the trick
This script is tuned for my system, so you might need to tweak the setting for MAX_RSS on your system. You might also prefer to change how often to check for memory overrun.

The usual disclaimers apply, but given you run this as a user not as root I doubt much damage is possible. I am not responsible for the outcome anyone encounters running the above script. It has been a while since I coded for the shell, so I am sure an expert could improve on this or even code one better in another language. Once I confirm this is operating properly I plan to start it with my system to avoid future problems.

Dave

PS: It did restart cinnamon when it hit the max, but then the script hung and I had to ctl-c to break out of it.
mikeflan
Level 16
Level 16
Posts: 6969
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: cinnamon runaway memory problem

Post by mikeflan »

The ps command will give me the resident memory, but I don't see how to get the shared memory so I can determine the private memory.
I have more interest in this topic since I have had to restart Cinnamon after waking up from the last 2 suspends. Not a huge deal, but I almost never need to restart Cinnamon. I would like to know how to easily see the memory used by Cinnamon. I'll be studying all posts to this topic.
System Monitor - Cinnamon - properties:
mem.png
Those seem like small numbers to me.
dhdurgee
Level 4
Level 4
Posts: 434
Joined: Thu Jul 02, 2009 7:56 pm

Re: cinnamon runaway memory problem

Post by dhdurgee »

The following script works for me:

Code: Select all

#!/bin/bash
#
# script to monitor and restart cinnamon when it gobbles memory
#
# Note: requires xdotool to signal cinnamon-killer-daemon
#
 MAX_RSS=360448  # 352MiB threshold for RSS
 SLEEP_TIME=20   # time between memory checks
#
#echo 'MAX_RSS='$MAX_RSS
#echo 'SLEEP_TIME='$SLEEP_TIME
 while true
  do
   sleep $SLEEP_TIME
   CIN_RSS=`ps -C cinnamon -o rss h`
#  echo 'CIN_RSS='$CIN_RSS
   if [ $CIN_RSS -gt $MAX_RSS ]
    then
#    echo 'restarting cinnamon'
     RC=`xdotool key "ctrl+alt+Escape"`
#    echo 'RC='$RC
   fi
  done
As usual your mileage may vary and you use this script at your own risk. Adjust the RSS threshold and check time to suit your system. You must have xdotool installed and this script assumes the standard ctrl+alt+escape sequence is set to restart cinnamon.

Dave
JosephM
Level 6
Level 6
Posts: 1458
Joined: Sun May 26, 2013 6:25 pm

Re: cinnamon runaway memory problem

Post by JosephM »

If all of you seeing this problem are using the Places Manager applet, could you try removing it and seeing if you see the same problem keep happening?
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
Locked

Return to “Cinnamon”