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
[Omega] Kodi is unable to exit cleanly when certains addons are enabled #25114
Comments
Here's the output of valgrind output (with addons enabled)$ DEBUGINFOD_URLS=https://debuginfod.archlinux.org valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes /usr/lib/kodi/kodi.bin`
==225846== Memcheck, a memory error detector
==225846== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==225846== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==225846== Command: /usr/lib/kodi/kodi.bin
==225846==
==225846== Syscall param ioctl(generic) points to unaddressable byte(s)
==225846== at 0x7CFF00D: ioctl (ioctl.c:36)
==225846== by 0xD95597: open_restricted(char const*, int, void*) (LibInputHandler.cpp:39)
==225846== by 0x66933C5: UnknownInlinedFun (libinput.c:2047)
==225846== by 0x66933C5: evdev_device_create (evdev.c:2407)
==225846== by 0x66A5F53: device_added (udev-seat.c:121)
==225846== by 0x66A632E: UnknownInlinedFun (udev-seat.c:202)
==225846== by 0x66A632E: udev_input_enable (udev-seat.c:315)
==225846== by 0x66A64B1: libinput_udev_assign_seat (udev-seat.c:452)
==225846== by 0xD97354: CLibInputHandler::CLibInputHandler() (LibInputHandler.cpp:91)
==225846== by 0x1DC581A: KODI::WINDOWING::GBM::CWinSystemGbm::CWinSystemGbm() (WinSystemGbm.cpp:91)
==225846== by 0x1DCDBFD: KODI::WINDOWING::GBM::CWinSystemGbmGLContext::CWinSystemGbmGLContext() (WinSystemGbmEGLContext.h:40)
==225846== by 0x1DCDCBF: KODI::WINDOWING::GBM::CWinSystemGbmGLContext::CreateWinSystem() (unique_ptr.h:1070)
==225846== by 0x1DCEC0A: std::_Function_handler<std::unique_ptr<CWinSystemBase, std::default_delete<CWinSystemBase> > (), std::unique_ptr<CWinSystemBase, std::default_delete<CWinSystemBase> > (*)()>::_M_invoke(std::_Any_data const&) (invoke.h:61)
==225846== by 0x10BCF6D: KODI::WINDOWING::CWindowSystemFactory::CreateWindowSystem(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (std_function.h:591)
==225846== Address 0x1 is not stack'd, malloc'd or (recently) free'd
==225846==
==225846== Syscall param ioctl(generic) points to uninitialised byte(s)
==225846== at 0x7CFF00D: ioctl (ioctl.c:36)
==225846== by 0x7599310: drmIoctl (xf86drm.c:704)
==225846== by 0x1E0E5B23: UnknownInlinedFun (xf86drm.c:1016)
==225846== by 0x1E0E5B23: mos_gem_bo_export_to_prime(mos_linux_bo*, int*) [clone .lto_priv.0] (mos_bufmgr.c:3569)
==225846== by 0x1E27ABAA: UnknownInlinedFun (mos_bufmgr_api.c:899)
==225846== by 0x1E27ABAA: DdiMedia_ExportSurfaceHandle(VADriverContext*, unsigned int, unsigned int, unsigned int, void*) (media_libva.cpp:7220)
==225846== by 0x5F56AFC: vaExportSurfaceHandle (va.c:1580)
==225846== by 0xDC1C80: VAAPI::CVaapi2Texture::TestEsh(void*, void*, unsigned int, int) (VaapiEGL.cpp:633)
==225846== by 0xDC1DAB: VAAPI::CVaapi2Texture::TestInterop(void*, void*, bool&, bool&) (VaapiEGL.cpp:690)
==225846== by 0xDC0BAD: CRendererVAAPIGL::Register(VAAPI::IVaapiWinSystem*, void*, void*, bool&, bool&) (RendererVAAPIGL.cpp:46)
==225846== by 0x1DCD9BD: KODI::WINDOWING::GBM::CWinSystemGbmGLContext::InitWindowSystem() (WinSystemGbmGLContext.cpp:67)
==225846== by 0x142693B: CApplication::CreateGUI() (Application.cpp:488)
==225846== by 0x1250159: XBMC_Run (xbmc.cpp:36)
==225846== by 0xAF8B95: main (main.cpp:70)
==225846== Address 0x1ffefffa54 is on thread 1's stack
==225846== in frame #2, created by mos_gem_bo_export_to_prime(mos_linux_bo*, int*) [clone .lto_priv.0] (xf86drm.c:3560)
==225846== Uninitialised value was created by a stack allocation
==225846== at 0x1E0E5AB0: mos_gem_bo_export_to_prime(mos_linux_bo*, int*) [clone .lto_priv.0] (mos_bufmgr.c:3560)
==225846== I will provide the output of valgrind without addons enabled later on. |
New development: I cannot reproduce any longer if I downgrade to python 3.11! So, maybe some threading related code changed in 3.12? |
@rien333 It seems python 3.12 has a bug thats impacting a lot of things. python/cpython#118618 |
Right, will close this if it indeed turns out that python needs to do all the fixing. I'll be testing whenever an official fix lands. |
This is a duplicate of #24440 |
@obaterspok Indeed, this issue may well be related to #24440/the python issue described therein. However, since I'm not actually experiencing a crash (just a hang), I'm not entirely sure if it's a duplicate just yet. However, if I can no longer reproduce this with python fix that is being thrown around there, I'll surely close this! |
Confirmed this as a python issue - applying this patch fixes my issue. Sorry for the noise! |
Bug report
Describe the bug
After having upgraded to Omega, I'm having trouble getting kodi to exit gracefully. That is, after quiting kodi from the UI/terminal/remote Android app/with
kodi-send -a 'Shutdown()'
, kodi hangs and must be quit forcefully, i.e. by sending it a SIGKILL signal.I narrowed down the problem to a few specific addons (netflix, twitch, and youtube). When at least one of these addons is enabled, kodi fails to exit. When all of these addons are disabled, kodi is able to exit normally. For completeness sake, I should mention that the common plugin cache and the 'kodi version check' addons seemed to produce the same behavior (though I haven't experimented with them a lot). One possible through line, here, is that all/most of these addons are launched when kodi launches. (edit: I've further narrowed down the problem to python 3.12)
Obviously, I initially contacted the relevant addon developers (see anxdpanic/plugin.video.youtube#738 and CastagnaIT/plugin.video.netflix#1697) , all the more because multiple forum posts indicated that addons are typically to blame for this type of problem (see e.g. this and this one). However, one addon dev redirected me here, as my logs indicate that their addon does indeed terminate correctly (running
info threads
ingdb
seems to corroborate this observation, as the remaining threads when the program finally entersCDRMUtils::RestoreOriginalMode
are "Announce", "Lirc", and "kodi.bin"). There's something to be said for the suggestion that the problem is not entirely on the addon developers, as it is conspicuous that multiple addons have stopped working simultaneously. (of course, the problem could theoretically also be something I or the Arch linux devs did)Stack and thread info with one of the problematic addons enabled
Here's some info I generated by poking around in
gdb
. This information was generated with one of the problematic addons enabled. Further below, I provide the same information, but without any of these addons enabled (in which case kodi can exit normally).From my naive point of view, the problem seems to be some kind of mutex deadlock. At least, there seem to be a bunch of threads just "idly" waiting around.
A list of all the threads:
Heres' a list of each threads' stack, after breaking on
CDRMUtils::RestoreOriginalMode
and having advanced the main thread ("kodi.bin") using(gdb) next
until nothing happens anymore. I am not sure if these are useful, so please guide in me in what info I need to provide:Thread number 1 ("kobi.bin")
Thread number 2 ("Announce")
Thread number 3 ("Lirc")
Thread numer 39 ("kodi.bin")
Stack and thread info without any of the problematic addons enabled
Thread info:
The application behaves differently without any of the problematic addons enabled, so I just
(gdb) next
on the main thread until it exits. Here is the interactive session, starting from the same breakpoint:Interactive gdb session
Expected Behavior
The kodi process exits swiftly and cleanly when I quit from the UI, or send it a SIGTERM signal.
Actual Behavior
Kodi hangs infinitely, and can only be killed with
kill -9 [PID]
Possible Fix
No idea. Honestly, I'm kind of worried I'm going to be directed back to the addon developers 😅
To Reproduce
Debuglog
The debuglog can be found here:
https://paste.kodi.tv/tikigugaca.kodi
(I forgot to disable
advancedsettings.xml
and my custom kodi skin, but I have determined numerous times that those don't impact the problem)Screenshots
N/A
Additional context or screenshots (if appropriate)
N/A
Your Environment
Used Operating system:
Android
iOS
tvOS
Linux
macOS
Windows
Windows UWP
Operating system version/name: Arch Linux (updated)
Kodi version: v21 (Omega)
Python version: 3.12
The text was updated successfully, but these errors were encountered: