Kodi Community Forum

Full Version: High CPU in 18.5 on Ubuntu 18.04
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have Kodi running on 3 boxes, all running Ubuntu & all are updated with latest packages etc.  All run Kodi 18.5.  One of them has started to experience high CPU whenever Kodi is running, even when it's not really doing anything.  By "high", I mean the kodi-x11 process uses 130% CPU on my 2-CPU machine.

This machine was running Ubuntu 16.04, and everything was fine until a few days ago.  I became aware of excessive fan noise and found that the CPU was always at this high level, even when Kodi was idle.  This problem started "fairly recently", but unfortunately I cannot pinpoint anything that might have happened on the system to cause it.  I am pretty certain it did not occur on Kodi 18.4, but cannot be certain that the problem started right after upgrading to 18.5.  I upgraded the system to Ubuntu 18.04 in an attempt to resolve, but no luck.

Other boxes are running Ubuntu, 18.04 or 19.10, and Kodi 18.5, with no problems.

I ran "strace" on the Kodi process in an attempt to get more details on what exactly is causing the high CPU.  Output of that is as follows:
Code:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 73.41    0.131024         339       386           poll
 15.92    0.028415          19      1534           nanosleep
  4.45    0.007948           0     17491           clock_gettime
  2.65    0.004729          13       371           ioctl
  1.52    0.002717         679         4           munmap
  1.24    0.002206           2      1460           read
  0.23    0.000406           1       374           lseek
  0.23    0.000403           2       227        12 futex
  0.20    0.000349           1       362       362 recvmsg
  0.11    0.000203           0       722           getpid
  0.04    0.000074          37         2           mmap
  0.00    0.000005           3         2           fstat
  0.00    0.000001           1         1           writev
  0.00    0.000000           0         2           getrusage
  0.00    0.000000           0         1           restart_syscall
------ ----------- ----------- --------- --------- ----------------
100.00    0.178480                 22939       374 total
"poll" appears to be the culprit.  

I've enabled debug logging, and turned on verbose logging for all the various components, but I don't get any information that would immediately point to a problem.

Can anyone suggest what might be going on or how I could troubleshoot this further?

Can anyone suggest
I'm still running ubuntu 16.04.6 as my daily driver, and I don't have a 'poll' process in my top listing. When googling there are some mentions of 'poll', but not directly related to v16.04. Also my C2D laptop with kernel 4.4.0.something seems to do okay. I'll check later for the poll process.

(2019-12-20, 15:59)jrmcfly Wrote: [ -> ]I upgraded the system to Ubuntu 18.04 in an attempt to resolve, but no luck.
I usually never upgrade my own systems, I always go for a new clean install. Just because of these situations.

(2019-12-20, 15:59)jrmcfly Wrote: [ -> ]Other boxes are running Ubuntu, 18.04 or 19.10, and Kodi 18.5, with no problems.
Perhaps you picked up something along the way with a fuzzy PPA repository?
(2019-12-20, 17:00)Klojum Wrote: [ -> ]I'm still running ubuntu 16.04.6 as my daily driver, and I don't have a 'poll' process in my top listing. When googling there are some mentions of 'poll', but not directly related to v16.04. Also my C2D laptop with kernel 4.4.0.something seems to do okay. I'll check later for the poll process.
(2019-12-20, 15:59)jrmcfly Wrote: [ -> ]I upgraded the system to Ubuntu 18.04 in an attempt to resolve, but no luck.
I usually never upgrade my own systems, I always go for a new clean install. Just because of these situations.
(2019-12-20, 15:59)jrmcfly Wrote: [ -> ]Other boxes are running Ubuntu, 18.04 or 19.10, and Kodi 18.5, with no problems.
Perhaps you picked up something along the way with a fuzzy PPA repository? 
'poll' isn't a process. It's a system call. Of course you won't see it in top. He used strace. In any case, all poll does is wait for a file descriptor from a set of file descriptors to be ready for IO. It is an IO bound system call, and shouldn't be a cause of a CPU usage spike.

I think he needs to post a debug log to see what's going on.
(2019-12-20, 17:33)yasij Wrote: [ -> ]'poll' isn't a process. It's a system call. Of course you won't see it in top. He used strace
You can tell I'm not a full-on Linux engineer.. Right? Big Grin
Thanks Klojum and yasij - I've posted a full debug log here: https://paste.kodi.tv/wivetudeda.kodi

It shows Kodi starting up, doing lots of startup activity, and then sitting idle - I waited until it was doing nothing apparent, and no further info was getting logged.  At that time, total CPU usage was 125%.  Then I stopped it, so you'll see a complete log.

Regarding a flaky PPA, nothing's been added there for quite a while, and also because this is a dedicated Kodi box the only non-Ubuntu PPAs are Kodi, TVHeadend, and Google Chrome.

Please let me know if any other info would be helpful.
Quote:2019-12-20 11:56:33.199 T:140664116750528  NOTICE: GL_VENDOR = NVIDIA Corporation
2019-12-20 11:56:33.199 T:140664116750528  NOTICE: GL_RENDERER = GeForce 210/PCIe/SSE2
2019-12-20 11:56:33.199 T:140664116750528  NOTICE: GL_VERSION = 3.3.0 NVIDIA 340.107
2019-12-20 11:56:33.199 T:140664116750528  NOTICE: GL_SHADING_LANGUAGE_VERSION = 3.30 NVIDIA via Cg compiler

Do you use our provided kodi exectuable to start? Nvidia has a swapbuffers bug which causes "render as fast as you can" else.

Code:
# Workaround for high CPU load with nvidia GFX
export __GL_YIELD=USLEEP
Thanks Fritsch - I do use the "kodi" executable that comes with the package.  The Nvidia card was installed about a year ago, to resolve some issues with jerky playback, and has been running like a champ ever since.  I tried the workaround you suggested, but it had no effect.
Okay - then try with strace and post the output please. (pastebin)
OK - strace of Kodi with the Nvidia workaround enabled is here: https://paste.kodi.tv/wacavihelo
Hi there, exact same issue here, and apparently exact same setup. My machine recently started doing the same thing, fan blowing like crazy and when i go look kodi-x11 is at 100% or more even when idle. It's been rock solid for years (literally, like 5 years!) and never seen anything like this.

Linux Mint 19.2 Xfce (based on Ubuntu 18.04) up-to-date, Kodi 18.5, GPU GeForce 210, nvidia graphics 340.107

I first thought the upgrade from Kodi 18.4 to 18.5 might have been related, but after downgrading to 18.3 (only version I could find) the issue is still there. Only thing I can see is that number of plugins got recently updated, I tried disabling them one by one but not all could be disabled due to dependencies, most notably some back-end services like python stuff and 'common plugin cache'.
Did you receive an nvidia update recently?

@jrmcfly 
Code:
strace kodi

We need everything on the shell
No - here is the syslog line about the Nvidia driver: NVRM: loading NVIDIA UNIX x86_64 Kernel Module  340.107  Thu May 24 21:54:01 PDT 2018

Nvidia has not issued any new updates for this chipset in a long time.
Here is the output of "strace kodi": https://paste.kodi.tv/ojirefidiq.kodi
That was worthless. Kodi did not even start.
(2019-12-21, 14:50)jrmcfly Wrote: [ -> ]Here is the output of "strace kodi": https://paste.kodi.tv/ojirefidiq.kodi
Sorry, pls use this strace output instead: https://paste.kodi.tv/akazagarom
Pages: 1 2