jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
207 stars 96 forks source link

[BUG] Skin Reboot with this plugin #1241

Closed mawrick26 closed 2 months ago

mawrick26 commented 2 months ago

Describe the bug

Hello

The skin load and after time kodi reboot. I think it's when tthe title of a movie or tv show contains accentuated character. After https://github.com/jurialmunkey/skin.arctic.fuse/issues/1065 and coreelec dev contacts, i try load skin without this plugin. No problem and everything work as intented so this plugin cause the reboot.

Steps To Reproduce

Load skin wit this plugin

Debug log

kodi.log

Screenshots and Additional Info

No response

Checklist

jurialmunkey commented 2 months ago

The plugin cant cause the crash directly because python doesn't work like that. This is an issue with either kodi itself, CoreELEC, or the specific version of python in use on your system having a bug in the decoding module.

MoojMidge commented 2 months ago

@mawrick26 - as mentioned you need to provide a crash log after debug logging is enabled. As it is there is simply not enough useful information to really verify what exactly is happening. It is certainly not clear that TMDbHelper is actually what is triggering the crashes you are seeing.

@jurialmunkey - I believe the issues that are being experienced are due to having emoji in file names, but don't think it is actually TMDbHelper that is causing Kodi to crash.

Suspect it is another plugin that the user has installed that is passing incorrectly encoded unicode data to Kodi listitem methods, which then triggers the crash in Kodi.

That being said the odd file names are creating issues with the listitem lookaheads that TMDbHelper does. From the log posted:

2024-09-01 10:41:36.838 T:18212   error <general>:   File "/storage/.kodi/addons/plugin.video.themoviedb.helper/resources/tmdbhelper/lib/monitor/images.py", line 30, in md5hash

2024-09-01 10:41:36.839 T:18212   error <general>: 
2024-09-01 10:41:36.839 T:18212   error <general>:     
2024-09-01 10:41:36.839 T:18212   error <general>: value = str(value).encode()
2024-09-01 10:41:36.839 T:18212   error <general>: 

2024-09-01 10:41:36.839 T:18212   error <general>: 
2024-09-01 10:41:36.839 T:18212   error <general>:  
2024-09-01 10:41:36.839 T:18212    info <general>: Skipped 11 duplicate messages..
2024-09-01 10:41:36.839 T:18212   error <general>: ^
2024-09-01 10:41:36.839 T:18212    info <general>: Skipped 18 duplicate messages..
2024-09-01 10:41:36.839 T:18212   error <general>: 

2024-09-01 10:41:36.839 T:18212   error <general>: 
2024-09-01 10:41:36.839 T:18212   error <general>: UnicodeEncodeError
2024-09-01 10:41:36.839 T:18212   error <general>: : 
2024-09-01 10:41:36.839 T:18212   error <general>: 'utf-8' codec can't encode character '\udce9' in position 26: surrogates not allowed

I think changing https://github.com/jurialmunkey/plugin.video.themoviedb.helper/blob/507d881d635821b9dd9b897211ad5f9d50bc1983/resources/tmdbhelper/lib/monitor/images.py#L30 to something like the following may avoid the issue

value = str(value).encode('utf-8', 'surrogatepass')
jurialmunkey commented 2 months ago

@MoojMidge

I believe the issues that are being experienced are due to having emoji in file names

🤦.jpg

I worry about people sometimes...

but don't think it is actually TMDbHelper that is causing Kodi to crash.

Yeah, if there's a crash it indicates a deeper issue that I wont be able to fix. Any "fix" will just be a workaround to avoid aggravating whatever the real cause is (e.g. as with the ElementTree accelerator issue that was in Python 3.10).

Python by itself, at worst, should just create log spam from exceptions, or plugin stops early because the exception wasn't caught in a try block (you know all this of course but just mentioning for the sake of completion).

That being said the odd file names are creating issues with the listitem lookaheads that TMDbHelper does. From the log posted ... value = str(value).encode('utf-8', 'surrogatepass')

Thanks. I can add this workaround to avoid the log spam.

Though, if it is logged then it does indicate that the exception is already being handled in whatever C module handles text codecs, so it can't be this specific error directly causing the crash (but maybe something adjacent).

mawrick26 commented 2 months ago

Thanks @MoojMidge and @jurialmunkey to check my problem.

I try with your last plugin version containing the fix 81cbd6c but the reboot still present.

@MoojMidge, i check my name file and don't have emojie @jurialmunkey i try the skin with only the strict necessary and all your skin cause the reboot

I suspect "script.skinvariables", here crash log kodi_crashlog_20240903082529.log

jurialmunkey commented 2 months ago

I suspect "script.skinvariables", here crash log

Why? You are speculating with no evidence.

The thread last running in your log (so most likely cause of crash in stacktrace) is /usr/lib/libc.so.6 This is not a file distributed by me. It is part of your system.

The issue appears to be something to do with the python binding PythonBindings::PyXBMCGetUnicodeString which coerces python objects into strings. This is not something I can fix. It needs to be fixed in core.

mawrick26 commented 2 months ago

Sorry but there is several error in logs and the problem appears only with your skins but i will check elsewere... Thanks for reply.