#1060672 kodi: High CPU usage even when idle

Package:
kodi
Source:
kodi
Description:
Open Source Home Theatre (executable binaries)
Submitter:
Giuseppe Sacco
Date:
2024-01-19 08:12:04 UTC
Severity:
normal
#1060672#5
Date:
2024-01-12 13:45:55 UTC
From:
To:
Dear Maintainer,
I intalled kodi a few days back in order to access all my media from a TV.
I executed and configured it using its GUI. Then I stopped it and run the
standalone version from a systemd unit in order to have it running all time.
I noticed that while nobody is using kodi from my TV, i.e., during nights, the
CPU usage is constantly about 8-12% for kodi.bin process.

Why? Is there anything that can be changed on the configuration in order
to stop this high CPU usage?

Just for reference, the CPU is Intel(R) Xeon(R) E3-1225 v3 @3.20GHz.

Thank you,
Giuseppe

#1060672#10
Date:
2024-01-12 14:05:56 UTC
From:
To:
Hi Giuseppe,

Thanks for report! The reportbug contents was probably truncated, as I see
no information about hardware, architecture etc.

What is your device specs?

#1060672#15
Date:
2024-01-12 15:52:43 UTC
From:
To:
Hello Vasyl,
I am trying kodi on a DELL PowerEdge T20, CPU E3-1225 v3 @3.20GHz, 32Gb of
RAM, Debian GNU/Linux 12 (bookworm).

Thank you,
Giuseppe

#1060672#20
Date:
2024-01-19 07:42:54 UTC
From:
To:
Hello Vasyl,
here is some information and a stack trace of the kodi thread that keep
consuming CPU.

From what I understand, the problem is in the renderer code, but I am calling
kodi in standalone, so I think the renderer should not used at all.

top output (with thread view):
-----------------------------------------------------------------------
top - 08:23:42 up 12 days, 17:25,  1 user,  load average: 0,17, 0,34, 0,54
Threads: 507 total,   1 running, 506 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3,9 us,  0,6 sy,  0,0 ni, 94,0 id,  0,5 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :  32005,4 total,   3096,0 free,   5365,6 used,  26530,5 buff/cache
MiB Swap:   1904,0 total,    681,9 free,   1222,1 used.  26639,7 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
3517230 giuseppe  20   0 2901040 108596  43788 S  11,6   0,3      9,02 kodi.bin
3517231 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   0:00.00 Announce
3517236 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   0:37.17 Lirc
3517279 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   0:49.54 libinput
3517280 giuseppe  39  19 2901040 108596  43788 S   0,0   0,3   0:00.00 kodi.bi:disk$0
3517281 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:16.58 kodi.bin:gdrv0
3517282 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:02.67 ActiveAE
3517283 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:01.61 AESink
3517284 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:00.00 FDEventMonitor
3517301 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:45.26 DetectDVDMedia
3517302 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:22.80 kodi.bin
3517303 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   1:35.60 PeripBusUSBUdev
3517304 giuseppe  21   1 2901040 108596  43788 S   0,3   0,3  15:36.00 PeripBusCEC
3517305 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   0:02.54 PeripBusAddon
3517306 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3  14:05.19 PeripEventScan
3517307 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:00.87 kodi.bin
3517308 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:46.74 kodi.bin
3517309 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:03.63 kodi.bin
3517310 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:02.75 kodi.bin
3517311 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:06.63 kodi.bin
3517312 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:02.63 kodi.bin
3517313 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:04.14 kodi.bin
3517314 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:00.78 kodi.bin
3517318 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:11.37 EventServer
3517319 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:10.68 TCPServer
3517320 giuseppe  21   1 2901040 108596  43788 S   0,0   0,3   0:03.45 kodi.bin
3517331 giuseppe  20   0 2901040 108596  43788 S   0,0   0,3   0:02.15 kodi.bin
3517225 giuseppe  20   0    2576    836    836 S   0,0   0,0   0:00.00 kodi
-----------------------------------------------------------------------

systemd output:
-----------------------------------------------------------------------
$ systemctl status kodi
● kodi.service - Kodi DLNA server
     Loaded: loaded (/etc/systemd/system/kodi.service; enabled; preset: enabled)
     Active: active (running) since Mon 2024-01-15 19:51:25 CET; 3 days ago
   Main PID: 3517222 (kodi-standalone)
      Tasks: 29 (limit: 38330)
     Memory: 164.8M
        CPU: 9h 2min 20.842s
     CGroup: /system.slice/kodi.service
             ├─3517222 /bin/sh /usr/bin/kodi-standalone
             ├─3517225 /bin/sh /usr/bin/kodi --standalone
             └─3517230 /usr/lib/x86_64-linux-gnu/kodi/kodi.bin --standalone

gen 15 19:51:26 mantide kodi-standalone[3517230]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
gen 15 19:51:26 mantide kodi-standalone[3517230]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
gen 16 16:32:17 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:32:18 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:32:20 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:32:23 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:32:39 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:38:59 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:39:15 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
gen 16 16:39:15 mantide kodi-standalone[3517230]: WARNING: Unhandled message: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=ActivatableServicesChanged
-----------------------------------------------------------------------

gdb output:
-----------------------------------------------------------------------
$ gdb /usr/lib/x86_64-linux-gnu/kodi/kodi.bin 3517230
GNU gdb (Debian 13.1-3) 13.1
[...]
Reading symbols from /usr/lib/x86_64-linux-gnu/kodi/kodi.bin...
(No debugging symbols found in /usr/lib/x86_64-linux-gnu/kodi/kodi.bin)
Attaching to program: /usr/lib/x86_64-linux-gnu/kodi/kodi.bin, process 3517230
[New LWP 3517231]
[New LWP 3517236]
[New LWP 3517279]
[New LWP 3517280]
[New LWP 3517281]
[New LWP 3517282]
[New LWP 3517283]
[New LWP 3517284]
[New LWP 3517301]
[New LWP 3517302]
[New LWP 3517303]
[New LWP 3517304]
[New LWP 3517305]
[New LWP 3517306]
[New LWP 3517307]
[New LWP 3517308]
[New LWP 3517309]
[New LWP 3517310]
[New LWP 3517311]
[New LWP 3517312]
[New LWP 3517313]
[New LWP 3517314]
[New LWP 3517318]
[New LWP 3517319]
[New LWP 3517320]
[New LWP 3517331]

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007faaf58e2385 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=0x7ffea4b47710, rem=0x7ffea4b47710) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
48	../sysdeps/unix/sysv/linux/clock_nanosleep.c: File o directory non esistente.
(gdb)
(gdb) bt 50
#0  0x00007faaf58e2385 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=0x7ffea4b47710, rem=0x7ffea4b47710) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
#1  0x00007faaf58e6c93 in __GI___nanosleep (req=<optimized out>, rem=<optimized out>) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2  0x000055685a6e36aa in KODI::WINDOWING::GBM::CWinSystemGbmGLContext::PresentRender(bool, bool) ()
#3  0x0000556859ac74c2 in CGraphicContext::Flip(bool, bool) ()
#4  0x0000556859dfe648 in CApplication::Render() ()
#5  0x0000556859dfe085 in CApplication::Run() ()
#6  0x000055685957425c in main ()
-----------------------------------------------------------------------

Bye,
Giuseppe

#1060672#25
Date:
2024-01-19 08:09:07 UTC
From:
To:
Hello Giuseppe,

I opened an issue [1] and hope to resolve your issue with there.

[1] https://github.com/xbmc/xbmc/issues/24539