Skip to content
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

Crash on start, kodi 21.1 flatpak, ubuntu 24.04 #1058

Closed
kalaninja opened this issue Aug 19, 2024 · 13 comments · Fixed by elgatito/elementum#136
Closed

Crash on start, kodi 21.1 flatpak, ubuntu 24.04 #1058

kalaninja opened this issue Aug 19, 2024 · 13 comments · Fixed by elgatito/elementum#136

Comments

@kalaninja
Copy link

Kodi crashes while starting if Elementum is enabled. When I disable it, everything works as expected.

Ubuntu 24.04 x86_64
Kodi 21.0 and 21.1 (both have this behaviour) installed with flatpak
Elementum 0.1.103

Kodi log: https://pastebin.com/JHd9gcLh

@antonsoroko
Copy link

@kalaninja
I had no crash with Kodi 21 from flatpak.
And i just have checked with kodi 21.1 from flatpak - also no issue.
I use Ubuntu 24.04.1 x86_64 with KDE (but this should not matter for flatpak).

If there was crash - there should be crash log in ${XDG_DATA_HOME} (e.g. kodi_crashlog-20240723_222243.log) - you can post it here, maybe it will help to identify the issue.

There is issue that sometimes flatpak kills elementum binary, but this is not elementum issue as i can see. Looks like jail/container restriction. see
#1051 (comment)
#1051 (comment)

but i am not flatpak expert and i do not see anything suspicious in their code for kodi container - https://github.com/flathub/tv.kodi.Kodi/tree/master

@simpledork47
Copy link

i've got similar issues (kodi 21.1 - linux amd64 debian testing )

  • random crash at kodi startup ( sometimes ok )
  • if no crash, kodi displayed, after a click on elementum addon : error message on top-right saying that launch ain't completed

that happened even with a "plain" kodi 21.1 install ( debian package from https://deb-multimedia.org/ / for testing/trixie)

in kodi logfile it looked like a network problem with JSON-RPC - elementum not being able to reach port 9090
whereas a debugging session didn't confirmed it ( netstat -lntp report 9090 as listening )

Same issue happened when I'm running kodi in flatpak

Btw I'm using Kodi Flatpak right now - with a custom build - for enabling HDR as described here flathub/tv.kodi.Kodi#248 , it works really great (kodi GBM with GLES)

This afternoon I've tweaked a bit elementum and it finally fixed it
Elementum > Settings > Advanced > "Force start as library" toggled

now elementum works perfectly, with kodi 21.1 within Flatpak

(didn't tested w/ debian package again)

@antonsoroko
Copy link

antonsoroko commented Sep 17, 2024

This feature was created specifically for new androids where new Kodi (complied with new android sdk) was not permitted to run binaries.
As I have seen it works a bit less stable than separate process, but stable enough.
I guess it should fix issue when flatpak kills Elementum process (since there is no process, Elementum is injected into Kodi process).

@kalaninja
Copy link
Author

Thanks for the reply. Really appreciate.

Yes, my issue looks very much like the one mentioned in the link. I'll try to use the "Elementum > Settings > Advanced > "Force start as library" workaround.

@kalaninja
Copy link
Author

@simpledork47 @antonsoroko
I tried to set "Elementum > Settings > Advanced > "Force start as library" feature toggle. Kodi starts up fine now. But every time I start a video play, kodi crashes.

Kodi log: https://pastebin.com/FAh4UjLT
Elementum log: https://pastebin.com/aMABENA2

the crash log is not created.

@simpledork47
Copy link

@kalaninja

On log file there's a folder for Download set: /home/kalan/Videos

Regular flatpak application can't see much outside of ~/.var/app/<application_id>

Could you verify this on your side ?

flatpak info --show-permissions tv.kodi.Kodi

...
filesystems=/mnt;xdg-pictures;xdg-videos;/run/udev:ro;/run/lirc;xdg-music;/media;/run/media

=> That's the line to look for

You can check if there's some additional paths granted:
flatpak override --show tv.kodi.Kodi

Granting access to your homedir
flatpak override tv.kodi.Kodi --filesystem=home

@antonsoroko
Copy link

by default it has xdg-videos
from https://docs.flatpak.org/en/latest/sandbox-permissions.html
xdg-videos | Access the XDG videos directory | $XDG_VIDEOS_DIR or $HOME/Videos

so it it not the issue.

@antonsoroko
Copy link

I was able to reproduce the bug (it happens on my system every time), and once i was able to catch golang stack trace for SIGSEGV.

elementum 1058 flatpak crash library mode.txt

but i do not see the root cause.
maybe @elgatito can take a look into it.

@simpledork47
Copy link

sorry for the previous noise, I didn't tested long enough. Sometimes it's ok, and most of the time it either crash when a video is about to play or even play ok but once stopped it's a crash.

I've looked carefully, getting back to regular "elementum" process (no library anymore)

First strange thing is lockfile : it gets resolved to addons/plugin.video.elementum/.lockfile insted of userdata/addon_data/plugin.video.elementum/.lockfile (this one exists on disk).

If I remove manually the file prior to run flatpak : all is working

I've made a pull-request with 2 changes ( fixing lockfile path ) and removing this file only if the system is detected as flatpak

@antonsoroko
Copy link

@simpledork47

JFYI:

in kodi logfile it looked like a network problem with JSON-RPC - elementum not being able to reach port 9090 whereas a debugging session didn't confirmed it ( netstat -lntp report 9090 as listening )

elementum tries to connect to localhost with ipv4 and ipv6, that's why you saw "error" in log. i guess you saw

warning <general>: [plugin.video.elementum] DEBU  xbmc         ▶ Init             Could not connect to the host ::1: dial tcp [::1]:9090: connect: connection refused

but if later in log you see

warning <general>: [plugin.video.elementum] DEBU  xbmc         ▶ Init             Adding local host 127.0.0.1

then everything is ok.

it just means that kodi does not listen on ipv6 local address.

https://github.com/elgatito/elementum/blob/de4ac744eaa7e26131f4d4bea3da0d4ed01348f0/xbmc/jsonrpc.go#L43

@antonsoroko
Copy link

@simpledork47

please try with plugin.video.elementum-v0.1.103-5-g5f482fc.linux_x64.zip
it has fix for this issue and for alerts issue.

alternatively you can build it yourself:
clone both repos, apply changes from PR, then
in elementum directory:
$ make linux-x64 linux-x64-shared
in plugin.video.elementum directory:
./bundle.sh --target=$HOME/downloads/ --platform=linux_x64 --binaries=$HOME/work/elementum/build/
(i have both dirs in ~/work, change paths accordingly to your case)

see docs if needed:
https://github.com/elgatito/plugin.video.elementum/blob/master/README.md#build
https://github.com/elgatito/elementum/blob/master/README.md#easy-development-environment-set-up

@simpledork47
Copy link

thanks @antonsoroko

I've installed your build and all is fine

@kalaninja
Copy link
Author

It works on my side too. Thanks a lot @antonsoroko and @simpledork47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants