gnome-shell uses 100% CPU

Bug #1800101 reported by René Schultz Madsen
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gnome-shell (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

For no obvious reason gnome-shell starts to use 100% CPU.

This is a standard install of Ubuntu 18.04 with no special extensions installed.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gnome-shell 3.28.3-0ubuntu0.18.04.2
ProcVersionSignature: Ubuntu 4.15.0-38.41-generic 4.15.18
Uname: Linux 4.15.0-38-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Oct 26 10:03:02 2018
DisplayManager: gdm3
ExecutablePath: /usr/bin/gnome-shell
InstallationDate: Installed on 2018-08-15 (71 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: gnome-shell
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
René Schultz Madsen (p-rm-l) wrote :
tags: added: nvidia performance
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Does the problem eventually end? How long has it stayed at 100% CPU?

If the problem persists then please log into a VT (Ctrl+Alt+F4) and collect a backtrace (or backtraces) of the offending gnome-shell process using these steps:

https://wiki.ubuntu.com/Backtrace#Already_running_programs

Changed in gnome-shell (Ubuntu):
status: New → Incomplete
Revision history for this message
René Schultz Madsen (p-rm-l) wrote :

It does not end by it self, tried to let it run for 48 hours, but still at 100%.
I have to restart to get it to normal.

I'll do that next time it hugs the CPU. Normally it does so after 5-10 days of continuers running.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Can you please try uninstalling the Nvidia driver (for a moment), reboot, and if the default 'nouveau' driver works for you then please let us know if that also avoids the 100% CPU problem?

I am wondering if the problem is unique to the Nvidia driver.

Revision history for this message
René Schultz Madsen (p-rm-l) wrote :

The problem is not there on a regular basis and I have only seen it 3 times since the installation of this computer.

I don't know how to reproduce the problem and I can't live with the pure performance of 'nouveau' on this production computer.

Why do you suspect the nvidia driver to be the problem?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Because the Nvidia driver has known performance issues that the nouveau driver doesn't have. Sounds surprising, I know...

Revision history for this message
Marko Kohtala (marko-kohtala) wrote :

I had high CPU and unresponsive gnome desktop on older Ubuntu virtual machine that was upgraded to 18.04 LTS from earlier past LTS versions on VirtualBox 5.2.18 or earlier running on Windows 10. The high gnome-shell CPU and unresponsiveness was randomly triggeded eg. by resizing application windows. I was able to switch to text virtual terminal using Ctrl-Alt-Fn and the gnome-shell CPU load decreased while in text mode. It has not occurred since I changed using gnome-tweaks the application appearance to Adwaita.

I recently installed a new 18.04 LTS that also became unresponsive at similar application or VirtualBox window resize. I am not 100% sure if this is same problem as I have VirtualBox 5.2.22 now and I was unable to change to text virtual terminal after VirtualBox window resize. This hang happened at least on VirtualBox windows resize. The virtual machine was able to shutdown through ACPI. I changed to Adwaita from Ambience and now I have been able to change window sizes without hang. Due to randomness, hard to say this problem is completely gone by theme change.

gnome-tweaks shows no extensions enabled. Now at gnome-shell 3.28.2-0ubuntu0.18.04.1.

VirtualBox has 3D acceleration enabled, no 2D acceleration. I have an old AMD Radeon HD 6450 with a bit old drivers from 2015, I noticed.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Marko,

Please log your own separate bug.

Revision history for this message
René Schultz Madsen (p-rm-l) wrote :

Daniel,

Now I have experienced the 100% CPU to more times and both times I tried to follow the guide here https://wiki.ubuntu.com/Backtrace#Already_running_programs but it's not possible to go to do "If the program hangs but doesn't crash you can press ctrl+c in gdb while the program is frozen and then continue with the next step."

Then gdb hangs :-P so no luck there. See attatched gdb log file. Any suggestions what to do next?

The thing I have noticed now with the 100% CPU usage is that it's always after restarting a VM several times in VirtualBox.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

René,

You need to have logged in from another machine (via ssh) and run gdb from there. That way gdb won't hang when you stop the shell with Ctrl+C.

Please also remember to try uninstalling the nvidia driver (briefly) so as to compare with nouveau.

Revision history for this message
Ansis Atteka (ansisatteka) wrote :
Download full text (6.6 KiB)

I am seeing high CPU utilization by gnome-shell process as well. Especially when using Chrome Web Browser and moving/resizing windows. Chrome usage goes up too. This issue happens consistently on 18.04. The system becomes barely responsible to user input.

Based on strace output of gnome-shell process here is behavior that caught my attention:

1, gnome-shell invokes clock_gettime() and futex() system calls excessively.
2. gnome-shell on recvmsg() system call receives errors.

sudo strace -c -f -p `pidof gnome-shell`
strace: Process 2028 attached with 18 threads
^Cstrace: Process 2028 detached
strace: Process 2141 detached
...
strace: Process 2566 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
 69.38 0.047219 1312 36 3 futex
 18.60 0.012661 3 4375 clock_gettime
  5.18 0.003527 9 390 346 recvmsg
  2.05 0.001398 10 137 poll
  1.86 0.001263 4 315 getpid
  1.25 0.000851 12 69 writev
  0.84 0.000570 9 62 write
  0.52 0.000357 2 156 sched_yield
  0.23 0.000156 4 37 read
  0.06 0.000038 38 1 restart_syscall
  0.03 0.000019 6 3 nanosleep
------ ----------- ----------- --------- --------- ----------------
100.00 0.068059 5581 349 total

It seems that high CPU usage originates from NVidia's shared library (binary distributed with libnvidia-gl-390:amd64 debian package). The gnome-shell process loads this library.

# sudo strace -k -o /tmp/aaa -f -p `pidof gnome-shell`

Here is proof that those calls to clock_gettime() system function originate from NVidia library:

2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=821854879}) = 0
 > /lib/x86_64-linux-gnu/libc-2.27.so(syscall+0x19) [0x11b839]
 > /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.390.77(vk_icdGetInstanceProcAddr+0x5865) [0xab445]
2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=824319178}) = 0
 > /lib/x86_64-linux-gnu/libc-2.27.so(syscall+0x19) [0x11b839]
 > /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.390.77(vk_icdGetInstanceProcAddr+0x5865) [0xab445]
2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=826767633}) = 0
 > /lib/x86_64-linux-gnu/libc-2.27.so(syscall+0x19) [0x11b839]
 > /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.390.77(vk_icdGetInstanceProcAddr+0x5865) [0xab445]
2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=829303953}) = 0
 > /lib/x86_64-linux-gnu/libc-2.27.so(syscall+0x19) [0x11b839]
 > /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.390.77(vk_icdGetInstanceProcAddr+0x5865) [0xab445]
2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=831753193}) = 0
 > /lib/x86_64-linux-gnu/libc-2.27.so(syscall+0x19) [0x11b839]
 > /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.390.77(vk_icdGetInstanceProcAddr+0x5865) [0xab445]
2028 clock_gettime(CLOCK_MONOTONIC, {tv_sec=14361, tv_nsec=834216603}) = 0
 > /lib/x86_64-linux-gnu/libc-2.2...

Read more...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ansis, please log your own separate bugs for each different scenario that uses high CPU. When doing so note also that strace information is not useful, but thanks anyway.

This bug is for René Schultz Madsen only, still awaiting feedback from comment #11.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gnome-shell (Ubuntu) because there has been no activity for 60 days.]

Changed in gnome-shell (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.