-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[BUG] Kodi crashing when switching from an add-on to another #6266
Comments
I'm having issues after python update. |
@rootcoder yes, it appears to be an issue with the new python version, but it doesn't seem to affect everyone and i couldn't find any report on Kodi forums or GitHub. |
Please have a look at; Originally posted by @Maven85 in xbmc/xbmc#20853 (comment) and https://forum.libreelec.tv/core/search-result/129687/?highlight=Python going to close these 2 issues as known issues - upstream addons. If there is a specific LE bug that needs to be fixed. Please reopen. But will need to know the detail and addon. Feedback via the forum would be great too. |
Ok, i did found those comments you linked, but in my case it's the Netflix addon and none of the addons mentioned there are installed on my system. I pinged CastagnaIT on Kodi forums about it, maybe he's aware of this issue. In the meantime on the production drive i switched back to an older nigthly that i had around and will keep another testing drive for further development on the matter. |
I suspect it might be caused by this python bug which doesn't seem to be fully fixed (python issue is still open): |
@pretoriano80 thanks for the additional info - reopened |
@heitbaum and @HiassofT i went further with the testing and i can reproduce the same crashing pattern with the latest Kodi nightly on my Android device (smartphone) , so definitely not a LibreELEC bug and not limited to LibreELEC. However, i think that you guys have a much better way to communicate with the Kodi team directly and i'm certain that it will be solved at some point. P. S. Maybe it's also a good thing to keep this bug report open, so if other LibreELEC users encounter this problem, will not open duplicate bug reports. |
@pretoriano80 please create a kodi issue about the Android crash |
Done, here it is - > xbmc/xbmc#21045 |
I applied the patch provided in that bug report but it seems that the issue is still there. However, over the weekend i will have some more time for testing, so if you guys have more hints about this issue i will gladly test them. |
Is this the patch you tried? |
Nope,i've tested the patch from here --> https://bugs.python.org/issue46070 |
I have built python asi debug and got something more from stacktrace:
Line where it crashed was on static PyObject *
s_pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{
char *buf;
PyStructObject *soself;
/* Validate arguments. */
soself = (PyStructObject *)self;
assert(PyStruct_Check(self));
assert(soself->s_codes != NULL);
if (nargs != soself->s_len)
{
PyErr_Format(_structmodulestate_global->StructError,
"pack expected %zd items for packing (got %zd)", soself->s_len, nargs);
return NULL;
}
... |
I checked and all the patches in https://bugs.python.org/issue46070, including python/cpython@52937c2, are included in python 3.9.10, which is now in LibreElec nightly builds. Which still crashes to me. Also in this bug issue 46070, there are multiple issues:
Any patches to debug by printing the interpreter of the obj are pending but no more fix is left in this 46070 report. Though I admit our issue might be related to the objects shared between interpreters, we will have to add to the issue for it to go further. My own issue is Kodi crashes when trying to play a second video, using Jellyfin add-on which could be close to this one. |
@WallyCZ the log is from a crash caused by the issue i presented heee, when switching from an add-on to another? @prahal apart from the issue you have with jellyfin, did you also tried to reproduce the issue from this bug report? Unfortunately, for a proper bug report to python devs, an easy way to reproduce the issue must be provided which in our case it is not (install kodi, addons, etc). |
@pretoriano80 yes but I do not have netflix. I reproduced with jellyfin your use case. I go in jellyfin addon, open a menu then go to another addon namely Dailymotion, then back in jellyfin: crash. About WallyCZ log, I am trying to reproduce. Rebuilding LibreElec with DEBUG=Python3,kodi . His crash report gave me hope that a test case could be build. |
@prahal great, i also managed to reproduce it without Netflix, so definitely there's more about this bug, not limited to only a few addons. |
@pretoriano80 you should reproduce with a debug build : "DEBUG=Python3,kodi" added to "make release". |
Yes, i already have the debug build, will test it soon. |
Ok,so i managed to get more crash logs from LE11 debug build.
Note: It seems that other addons i've tested (eg. Tubed) aren't crashing if YouTube or Netflix addons are not in the mix (aka disabled or not installed), but they do crash with the "addon switch combo" and YT or Netflix involved. |
we have the same traces (Thread 1, python 3.9 one of mine). My first attempt at a fix was to check python 3.10 changes not backported to 3.9 but I found out that 3.10 was also broken. |
That can be the same issue as yours even if stack trace is different since I used the build option |
@WallyCZ thanks. Could you paste the full build command for --with-pydebug ? |
Here is Python's package.mk I used https://paste.kodi.tv/acawitaqiy |
running this on the kodi Odroid C2 with python 3.9.11 segfault:
This thanks to https://forum.libreelec.tv/thread/25454-generic-nightly-kodi-restarts-after-loading-sqlite3/ which found that an addon with only import sqlite3 in crashes kodi. I extracted most of the test case from the initial https://bugs.python.org/issue46070 test case for the windows issue win_py399_crash_reproducer.py. That should be enough for a python upstream bug report. Still I will do more tests on my side before that so feel free to open it beforehand. |
For now i won't open a bug report with python devs for several reasons. Another reason would be the testing environment, meaning that probably they won't like the idea of testing this on LibreELEC (even if it's clear that this is not caused by LibreELEC). Probably it would be best if one of the developers behind the affected addons (Netflix,YouTube, etc) open a bug report with cpython devs and i'm saying this because they know the code used in their addons, hence the capacity to better understand the technical details. |
I can reproduce with a vanilla build of cpython github 3.9.11 tag on x86_64 (I checked a few runs and even on LibreElec the test case only crashes 90% of the time, so if it works the first time, retry). This vanilla build was without LE patches to python.
python backtrace :
|
@pretoriano80 on the addon side, an addon which only code is "import sqlite3" reproduce the crash per https://forum.libreelec.tv/thread/25454-generic-nightly-kodi-restarts-after-loading-sqlite3/ . But on the kodi side, by changing the way they load addon they could workaround the issue. Feel free to bug kodi devs. If at all that will help kodi devs triage the bug reports that relates to this issue. I will bug report the cpython devs as I have a test case and traces that only involves the python source code that should do on their side. |
@pretoriano80 Oh sorry you already opened xbmc/xbmc#21045 . Then I will do my side :-) |
No problem! Yeah, the Kodi report was on Android, not so easy to debug as on LibreELEC. |
Here's the journalctl log from the Netflix addon on a debug build - > http://ix.io/3TnX It seems that it's indeed related to sqlite3. |
@WallyCZ are you sure you did a make clean before make release? When I add your changes to Python3 package.mk I get:
This because Pillow includes -I/home/prahal/Projects/WIP/libreelec/LibreELEC.tv/build.LibreELEC-AMLGX.arm-11.0-devel/toolchain/armv8a-libreelec-linux-gnueabihf/sysroot/usr/include/python3.9 instead of the now -I/home/prahal/Projects/WIP/libreelec/LibreELEC.tv/build.LibreELEC-AMLGX.arm-11.0-devel/toolchain/armv8a-libreelec-linux-gnueabihf/sysroot/usr/include/python3.9d (note the d added when I add py-debug and your CFLAGS. I can work around this pillow issue if I symlink the includes from python3.9d to python3.9 pillow in the build and redo the make release. But then kodi build fails with:
I have your --with-pydebug in PKG_CONFIGURE_OPTS_TARGET, CFLAGS='-DPy_DEBUG' in pre_configure_target and symlinking of python d suffixed libraries to non suffixed one in Python3 package.mk post_makeinstall_target NB: I noticed when one upgrade the python to build if the target python library name change I usually get a missing library from dependent packages and kodi does not start. A make clean is then required. |
@prahal i used his package.mk that he provided here and no "make clean" was required here. |
@pretoriano80 sorry, I meant you have to make clean if you want a proper build when one change python suffix or version number (which is the case in this pythn debug build) else your build still contains the old python suffix and the build succeed but is not fine (at runtime it still attempt to load the python library with the old suffix). |
@prahal I didn't make clean. If you do this, you will need couple of additional changes in build scripts because dependencies will try to ink with incorrect python library (without "d"). The easiest way is to build it with the original make files, then replace that package.mk and build it again without doing make clean. The package.mk contains symlink trick so every dependency will use debug version even if it was linked with non-debug. |
Thanks for this last tip that help me reproduce your struct bug. It turns out that yours is very likely a different bug. The struct crash happens even if you only wait doing nothing. From my logs, I suspect script.tubed to trigger it.
and more importantly, I get this debug trace with gdbserver and sourcing the LE build python-gdb.py into gdb-multiarch client:
Note the that is by:
|
@WallyCZ sorry I forgot to add that the current bug is fixed by reverting cpython commit 52937c26adc35350ca0402070160cf6dc838f359 (for python 3.9). But yours is still there even with that commit reverted. |
@prahal you meant script.tubecast?Tubed it's a different addon. |
@pretoriano80 thank you. @WallyCZ Indeed your issue is triggered by script.tubecast (not script.tubed) |
I will revert that commit and try a build without it. |
@pretoriano80 my pending push request is in http://sprunge.us/o9kNvR . I also told about this fix in https://bugs.python.org/issue46070 , no reply yet. Note that in 3.11 this commit is fine. It only breaks previous branches where it was backported. |
@prahal / @pretoriano80 - if this indeed fixes the issues you are experiencing in 3.9.y - raise a PR to include this patch in LE11? |
I'm testing a LE11 build with patched python 3.9.12 right now, :) |
Thank you for your analysis and it looks clear now that it is another issue. And indeed, I am confirming issues with this plugin even with non-debug version (more rare crashes). It crashes Kodi in about 20% of cases I am using it with the release version of python. Although I am not sure if the problem is in the addon itself because in my opinion no addon should crash Kodi even if it would do whatever. Probably should open new ticket on this, but wonder we have enough of information so somebody would bother with this... |
@prahal i can confirm that reverting that commit fixed the crashing ,tested with YouTube addon and Netflix . You said that you already have the PR on hold, so in this case feel free to raise the PR with LibreELEC. |
If someone wants to test the patch before a PR is raised,here's my branch with the patch -> https://github.com/pretoriano80/LibreELEC.tv/tree/revert-bpo46070 |
@WallyCZ you should definitely open a bug report, against the addon. Even if it is a python issue the addon manager might be able to help you narrow a test case. You have enough debug if this is an addon issue. I will not investigate further this issue for a long while as I have more pressing issues. |
Describe the bug
Kodi is crashing when switching from an addo-on to another, in this case it's either Netflix plugin or Tubed.
I only tested with these plug-ins because it's easy to reproduce (100% trigger rate)
To Reproduce
Steps to reproduce the behavior:
Note: Sometimes it may crash already at step 3.
Note 2: If you fail to reproduce on first try, just try again and it will certainly crash.
Informations
Log file
http://ix.io/3QHR
Additional context
~~
An important thing i noticed is that i can't reproduce the bug if only one of the addons is installed, meaning that if only Netflix is installed, then it won't cause any crash, same thing if only Tubed addon is installed.~~It seem that even after uninstalling Tubed addon,Netflix is still crashing if you leave Netflix ,open another addon and then go back to Netflix.
I have no clue if this is a bug caused by LibreELEC or some other Kodi related component.
I did some research and couldn't find any similar bug reports for Netflix addon, Tubed, Inputstream Adaptive or Input Stream Helper.
The text was updated successfully, but these errors were encountered: