Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown CPU usage puts laptop to a crawl until restarting Cinnamon #7844

Open
cschreib opened this issue Sep 11, 2018 · 42 comments
Open

Unknown CPU usage puts laptop to a crawl until restarting Cinnamon #7844

cschreib opened this issue Sep 11, 2018 · 42 comments

Comments

@cschreib
Copy link

cschreib commented Sep 11, 2018

 * Cinnamon version: 3.8.8
 * Distribution: Mint 19.0
 * Graphics hardware: Intel Corporation UHD Graphics 620 (rev 07)
 * Graphics driver: i915 (Mesa 18.0.5)
 * 64 bit
 * xsession-errors attached below

xsession-errors.txt

Issue
Somewhat randomly, and without direct action from my part, Cinammon starts using a 50% of my CPUs for about a minute or so. During this time my laptop becomes extremely sluggish, to the point where it becomes painful to just scroll through a terminal window. I can fix the problem by restarting Cinnamon from the panel right-click menu.

For example, this problem happened as I was typing this bug report in Firefox. The only activity in the system at that time was that I was listening to some music on Deezer in another Firefox tab.

Steps to reproduce
Unknown.

Expected behaviour
Cinnamon should have a constant and low CPU usage when I do not explicitly interact with it.

Other information
I am using a Lenovo Carbon X1 6th gen, with default linux kernel (4.15.0-33-generic) and a fresh install of Linux Mint 19. My hard drive disk is a 1 TB SSD. My home directory is encrypted. I am happy to help diagnose the problem, if there is anything I can do.

@MartinX3
Copy link

MartinX3 commented Sep 12, 2018

  • Laptop: ThinkPad T460P
  • CPU: Intel i7-6700HQ 4 cores / 8 threads
  • RAM: 64GB
  • Cinnamon version: Cinnamon 3.8.9
  • Distribution: Linux Mint 19
  • Graphics hardware: Nvidia 940MX
  • Graphics driver: 396.54-0ubuntu0~gpu18.04.1
  • 64 bit
  • SSD: 128GB Samsung 840 PRO
  • Kernel: 4.15.0-34-generic Search field in menu and mouse mouvement #37-Ubuntu SMP
  • Encyption: False
  • .xsession-errors: xsession-errors.txt
  • syslog: syslog.txt
Cinnamon slows down and only a logout, restart or "cinnamon --replace" is helping.
It lags and every lags uses 100% on one cpu thread.

@jaszhix
Copy link
Contributor

jaszhix commented Sep 12, 2018

@cschreib From the log, it looks like you're using a custom theme.

Cjs-Message: 10:23:36.088: JS LOG: [LookingGlass/info] loading user theme: /home/cschreib/.themes/Mint-Y-Dark-custom/cinnamon/cinnamon.css
Cjs-Message: 10:23:36.132: JS LOG: [LookingGlass/info] added icon directory: /home/cschreib/.themes/Mint-Y-Dark-custom/cinnamon
(cinnamon:1752): Gtk-WARNING **: 10:34:23.892: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.

Does the high CPU usage still occur when you switch back to default theme and icons? It could be a problem without how Cinnamon handles bad or missing icons, but that might be the way to fix it for your situation, or removing the system monitor applet.

@MartinX3 Your issue looks unrelated, you're hitting an error in the window list applet.

(cinnamon:2523): Cjs-WARNING **: 18:50:55.443: JS ERROR: TypeError: this.actor is null
_set_position@/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js:176:13
anonymous/show/this._sizeChangedId<@/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js:147:13
WindowManager.prototype._endWindowEffect@/usr/share/cinnamon/js/ui/windowManager.js:559:13
_addHandler/params[name]@/usr/share/cinnamon/js/ui/tweener.js:254:13
_callOnFunction@resource:///org/cinnamon/cjs/modules/tweener/tweener.js:203:13
_updateTweenByIndex@resource:///org/cinnamon/cjs/modules/tweener/tweener.js:337:9
_updateTweens@resource:///org/cinnamon/cjs/modules/tweener/tweener.js:350:18
_onEnterFrame@resource:///org/cinnamon/cjs/modules/tweener/tweener.js:365:10
_emit@resource:///org/cinnamon/cjs/modules/signals.js:142:27
ClutterFrameTicker.prototype._onNewFrame@/usr/share/cinnamon/js/ui/tweener.js:411:9
ClutterFrameTicker.prototype._init/<@/usr/share/cinnamon/js/ui/tweener.js:387:17

Another thing I noticed was this gnome screenshot error you're getting:

** Message: 18:56:28.186: Unable to select area using GNOME Shell's builtin screenshot interface, resorting to fallback X11.

doesn't occur with the patched version of gnome-screenshot in the mint repos. Doesn't necessarily mean its the cause of the high CPU usage (same with the window list error). As for all the nemo errors you're getting, you could try disabling nemo extensions that are activated, and see if it does less log spam - never seen those nemo errors before.

@MartinX3
Copy link

MartinX3 commented Sep 12, 2018

Thank you for your response.

Weird.
I installed every Linux Mint 19 update (level 1-5).
Do I miss something to fix my errors?

I only updated cinnamon and the Xapps with the standard repository.

@jaszhix
Copy link
Contributor

jaszhix commented Sep 12, 2018

You can check with apt-cache policy gnome-screenshot. For me this looks like

gnome-screenshot:
  Installed: 3.25.0-1linuxmint2
  Candidate: 3.25.0-1linuxmint2
  Version table:
 *** 3.25.0-1linuxmint2 700
        700 http://packages.linuxmint.com tara/upstream amd64 Packages
        100 /var/lib/dpkg/status
     3.25.0-0ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

@MartinX3
Copy link

MartinX3 commented Sep 13, 2018

That is my result

$ apt policy gnome-screenshot
gnome-screenshot:
  Installiert:           3.25.0-1linuxmint2
  Installationskandidat: 3.25.0-1linuxmint2
  Versionstabelle:
 *** 3.25.0-1linuxmint2 700
        700 http://mirror.netcologne.de/linuxmint/packages tara/upstream amd64 Packages
        100 /var/lib/dpkg/status
     3.25.0-0ubuntu2 500
        500 http://linux.mirrorhost.pw/ubuntu bionic/main amd64 Packages

I did not install new Nemo Extensions.
I'm using the default ones from the fresh installed Linux Mint 19 Cinnamon.
But every one was already deactivated.
Only the standard fileroller extension is activated.

Is there a way to debug, which cause this laggs while using cinnamon?

@cschreib
Copy link
Author

@jaszhix : I tried setting the theme back to the default Mint themes, and removing the CPU monitor applet. The problem still occurred. Maybe I could use a debugger to see which part of the code cinnamon gets stuck in? Any advice on how I could do that?

@cschreib
Copy link
Author

Following similar instructions to this Nemo issue, I was able to get Cinnamon running inside GDB and break (Ctrl-C) execution when the problem occurred. I managed to do this twice. The two backtraces (obtained with thread apply all bt) are here: gdb1.txt, gdb2.txt.

@cschreib
Copy link
Author

Some precisions regarding my first post:

  • "My home directory is encrypted." This is actually not true, I was confusing two different computers.
  • My laptop is a powerful, latest generation Lenovo machine, there is no way Cinnamon should be able to put it to a crawl during normal operations.

@ztolley
Copy link

ztolley commented Sep 26, 2018

Had this also.

Everything seems to work fine then out of the blue windows don't drag, they jump around when you move them. If you pick on a window to select it and mouse the mouse all over it doesn't bunch until you lift your finger off the mouse button. Scrolling too.

The cinnamon process goes to 100% while dragging around, When sitting idle and just watching top it uses 15-30% compared to the normal 1%.

There are some errors in the xsession log related to widgets (linked here https://1drv.ms/u/s!AvGldxw2T5t5lMsh_Gni5RIuscCW_g)

I also have the CPU monitor in the bottom bar so I've turned this off and will see if it happens again.

I suspect this is the widget though why can a widget bring cinnamon to its knees?

@jaszhix
Copy link
Contributor

jaszhix commented Sep 26, 2018

@ztolley Applets that update frequently might exacerbate it by forcing more frequent redraws of the whole screen. Muffin (master) now has newer versions of Clutter and Cogl, the libraries used to render in GL, and they are more optimized to prevent that. It could still be something else, but that seems the most likely.

@cschreib Your traces are stopping in parts of Muffin that have been updated on master.

If you're able to build Cinnamon and Muffin, I would be interested to know if it improves or not.

@MartinX3
Copy link

MartinX3 commented Sep 26, 2018

So it may kill my bug, too?

Is there an ETA for the next cinnamon update?

Edit: Update will be shipped with Linux Mint 19.1?

@jaszhix
Copy link
Contributor

jaszhix commented Sep 26, 2018

@MartinX3 There will be a performance increase, but not sure if it will solve the CPU usage issue in your environment, but one thing everyone has in common in this thread is they are using some kind of monitor applet that continually re-renders in the panel.

Not sure about the ETA, probably November or December judging from previous releases.

I built binaries. Only use these if you are comfortable testing beta software, no stability is guaranteed. If anything goes wrong, open the update manager and let it "upgrade" them back to their tagged versions. Install in this order: cinnamon-settings-daemon, cjs, muffin, and cinnamon, by entering each directory and running sudo dpkg -i *.deb, then sudo apt-get install -f afterwards.

https://drive.google.com/file/d/1kkdUil1BqyU-R5Khw9HJOhs6xENvpwSO/view

@MartinX3
Copy link

Thank you!

Will it "upgrade" my config files, so a downgrade will erase my configurations, widgets, etc?

@jaszhix
Copy link
Contributor

jaszhix commented Sep 27, 2018

@MartinX3 Just did a test run in VM - installed the packages, and was able to downgrade through the update manager. Configs should be fine. One small tweak to the instructions: after running sudo dpkg -i *.deb in a directory, you will need to correct dependencies with sudo apt-get install -f.

@MartinX3
Copy link

MartinX3 commented Sep 28, 2018

Thank you for your help. :)

I removed the taskbar applets: tastmanager (shows workload on network, cpu, ram, swap), CPU Temp, GPU Temp and the Optimus switch.

Now it looks like that the slowdown is solved.
But I still get the micro lags every 1-2 seconds.
I see them easily in the taskmanager or while I drag and move a window.
It makes little jumps between the smooth animation.

Maybe self updating taskbar applets are killing cinnamon?
My idle workload while hearing music in youtube is between 10%-20% on my 8 threads of my i7-6700HQ cpu while using the latest nvidia (GTX 940MX) drivers from the nvidia driver repository without these applets.

I will test your builds after I did wait a little more.
Maybe the slowdown is now "more slow".

@MartinX3
Copy link

Yes, now the microlags lags growing more slowly.
But they are getting still bigger.
Installing now your compiled stuff. :)

@MartinX3
Copy link

MartinX3 commented Sep 28, 2018

After installing the stuff and restarting only cinnamon, I can see, that the microlag in the taskmanager cpu workload animation is now much smaller.
I can still see it, but now I can drag and move a window or scroll in a list without a stopper.
Instead of a stopper, I now get a tearing.
But a tearing bug is much much muuuuch better that a stopper.

Thank you!
I will keep that version and whish the 19.1 update could be next month. :P

Idle CPU load is now between 1% and 15%.
That's much better.

@jaszhix
Copy link
Contributor

jaszhix commented Sep 28, 2018

@MartinX3 Do you have "Allow Flipping" enabled in nvidia-settings? It's required for vsync to work.

@MartinX3
Copy link

There is no "Allow Flipping" option. :(
(Running on Nvidia GPU)

@jaszhix
Copy link
Contributor

jaszhix commented Sep 30, 2018

Are you using the proprietary driver? Try nvidia-settings in bash, if nothing, run sudo apt-get install nvidia-settings. It will be on the "OpenGL Settings" page. Its supposed to be a default option. If you're using Mesa, then this may be a different kind of problem.

@MartinX3
Copy link

grafik
Yes, I know. :(

@jaszhix
Copy link
Contributor

jaszhix commented Sep 30, 2018

Can you paste the output of glxinfo | grep OpenGL? Optimus laptops can use Intel or Nvidia.

@MartinX3
Copy link

Of course. :)
I'm using nvidia, not intel.
Because I play a few games on the laptop and don't want to switch every time (user logout).

martin@deus-ex-machina:~$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 940MX/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 396.54
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 396.54
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 396.54
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
martin@deus-ex-machina:~$ 

@jaszhix
Copy link
Contributor

jaszhix commented Sep 30, 2018

I have an optimus laptop with an Nvidia 940M and can't seem to get it to switch from Intel - been testing with a 1080ti on my main PC. Can you try this muffin build?
https://drive.google.com/file/d/1vKTsr4YRl3qvHKAXS8lBb2API06fctJl/view?usp=sharing

Reverted an Nvidia-specific optimization. Just run sudo dpkg -i *.deb.

@jaszhix
Copy link
Contributor

jaszhix commented Oct 1, 2018

@MartinX3 I did some digging, got nvidia loading on my laptop, and was able to reproduce this. I was able to fix tearing - you will need to enable kernel mode setting for Nvidia. You can do that by

  • editing /etc/default/grub and appending nvidia-drm.modeset=1 to GRUB_CMDLINE_LINUX_DEFAULT, after quiet splash with a space.
  • Adding these modules to /etc/initramfs-tools/modules:
nvidia
nvidia_modeset
nvidia_uvm
nvidia_drm
  • Run sudo update-grub && sudo update-initramfs -u and reboot.

@MartinX3
Copy link

MartinX3 commented Oct 1, 2018

Do I still need to install the package?

I will now implement the DRM stuff. :)

@MartinX3
Copy link

MartinX3 commented Oct 1, 2018

I restarted my laptop.
No tearing. :)

But there are still these microlags while moving a window and in the cpu graph in the task manager.

But I like that I don't have any slow downs anymore.

But I still need to restart cinnamon to shutdown or restart my laptop.
Like I needed before while it was slow.

@jaszhix
Copy link
Contributor

jaszhix commented Oct 1, 2018

@MartinX3 Yeah, no need to install the second build.

But I still need to restart cinnamon to shutdown or restart my laptop.

Is it becoming unstable or slow after a while?

Thanks for the feedback.

@MartinX3
Copy link

MartinX3 commented Oct 1, 2018

I did not recognize it until now. :)

Could it change with the drm stuff?

Erm, if I want to connect to custom wifi networks, there won't be any dialog. I need to connect to a wifi with "hidden ssid" and write the connection details by hand.

And no problem testing it to make cinnamon better. :)

@jaszhix
Copy link
Contributor

jaszhix commented Oct 1, 2018

Could it change with the drm stuff?

Not sure, I'm still testing kernel mode setting myself, but likely a Cinnamon perf issue. I've been running cinnamon without the CPU temperature applet for the past couple days and performance seems to be better after a day of uptime - applets that update frequently on an interval seem to be a big contributor.

@ztolley
Copy link

ztolley commented Oct 2, 2018

Removing the CPU monitor applet fixed this

@cschreib
Copy link
Author

cschreib commented Oct 2, 2018

Yesterday I started using the compiled cinnamon + muffin provided by @jaszhix. Didn't experience any issue yesterday, and so left my laptop running over night as I usually do (I use it at work as a workstation). Sadly, today I had the problem occur again. To make sure this was indeed an issue with Cinnamon, I tried closing Firefox for a while, and had the problem happen once more. In both these cases my laptop was actually crunching some data (on a single thread, nothing super intense) while the CPU usage of Cinnamon starting ramping up and the laptop started loosing its responsiveness.

Since I had it happen also when the CPU monitor applet was removed from the panel, I'm not sure what could be causing this... @jaszhix : would it help if I tried again to get GDB traces with the compiled binaries you gave us?

@jaszhix
Copy link
Contributor

jaszhix commented Oct 2, 2018

@cschreib Sure. Would you be able to provide a fresh xsession-errors too? Thanks.

@MartinX3
Copy link

The prebuild packages sometimes don't let me wake up my laptop correctly.
I move my mouse, my monitor activates itself and instead of showing me the password files, I see some of my windows on 1 or 2 or all 3 monitors and can't do anything.
Need to restart PC, restart the logscreen or cinnamon in TTY1 did not help.

@cschreib
Copy link
Author

cschreib commented Oct 22, 2018

So the binaries provided by @jaszhix (and the updated hwmonitor applet) do not solve my problem. I still had the issue happen several times. Attached backtraces: gdb3.txt, gdb4.txt.

Fresh Xsession errors: xsession-errors.txt

@jaszhix
Copy link
Contributor

jaszhix commented Oct 22, 2018

@MartinX3

I move my mouse, my monitor activates itself and instead of showing me the password files, I see some of my windows on 1 or 2 or all 3 monitors and can't do anything.

Are you talking about the screensaver?

@cschreib Github is being flakey, so could only look at gdb3.txt. Its stopping (by you?) in a function that is responsible for drawing the windows, but that alone doesn't give much information since those functions will be called a lot, to paint a bunch of different windows. Not sure the traces are going to help unless its causing a crash.

Do you guys think the issue would occur if you disable the monitoring applets? Might be worth a try for a day or two - might get a better idea if they are causing it or not.

There's been a lot more changes on the master branches, I can build fresh packages a bit later.

@MartinX3
Copy link

MartinX3 commented Oct 22, 2018

@jaszhix
Yes, so I reinstalled again the repo packages and still looking of the appear would reappear.
Maybe reverting the packages to the default ones fixed it.

I don't use monitor applets anymore, so I don't get a big & fast slowdown with the default packages.
The music makes sometimes a jump every few seconds, but I can live with it until we get the upgrade.

A fresh build would be nice. :)

Btw:
Github is weird at the moment, I only see the new comments if I write a new comment and delete it again...

@cschreib
Copy link
Author

Do you guys think the issue would occur if you disable the monitoring applets? Might be worth a try for a day or two - might get a better idea if they are causing it or not.

@jaszhix : Did that already :( See below.

@jaszhix : I tried setting the theme back to the default Mint themes, and removing the CPU monitor applet. The problem still occurred.

As for the traces, indeed I created them by stopping execution manually (just when the slowdown occurred). In general when a slowdown happens in a program, if you manually break execution during the slowdown then very likely you'll be stopped inside the function that is slow. It's a cheap way of doing profiling, see for example: https://readwrite.com/2010/11/01/using-gdb-as-a-poor-mans-profi/

@jaszhix
Copy link
Contributor

jaszhix commented Oct 22, 2018

Ok, was just curious - the applet was still loaded in the .xsession-errors you provided.

Cjs-Message: 13:54:01.093: JS LOG: [LookingGlass/info] Loaded applet hwmonitor@sylfurd in 8 ms

Your traces are stopping in functions that control vsync. The first trace stops in compositor.c:1417, at a call to XSync, and the second trace stops in cogl-winsys-glx.c:1776 calling glXGetVideoSync -- at least as far as recognizable methods with symbols go - it bounces around in Mesa after that with no symbols. These code paths seem identical to Mutter's, so I'm not really sure what to make of it.

@cschreib
Copy link
Author

Could this point to a hardware or driver issue then?

@MartinX3
Copy link

I'm using the latest nvidia drivers (v410).
While posting my issue I tested it with v390 and v396.

@MartinX3
Copy link

Now I'm using v415 and cinnamon 4.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants