OSMC Crashes when trying to play Video

Hello
Working on my first and still very simple addon. When I test on my Ubuntu PC it works however when I installed the same addon on my Pi osmc crashes as soon as I call the video to be played
Here is the full log
Appreciate the help

Apr 10 20:29:27 osmc mediacenter[369]: terminate called after throwing an instance of 'std::logic_error'
Apr 10 20:29:27 osmc mediacenter[369]:   what():  busy dialog already running
Apr 10 20:29:27 osmc sudo[8106]: pam_unix(sudo:session): session closed for user osmc
Apr 10 20:29:27 osmc mediacenter[369]: /usr/bin/mediacenter: line 142:  8106 Aborted                 sudo -u osmc LIRC_SOCKET_PATH=/var/run/lirc/lircd $KODI --standalone -fs
Apr 10 20:29:27 osmc mediacenter[369]: Kodi exited with return code 134 after 37 hours, 12 minutes and 52 seconds

@sam_nazarko any insights on how I should interpret the error?
Much appreciated

I would suggest a debug build of OSMC (compiled from source) with gdb attached.

If the add-on is simple, but you are crashing Python this hard, then something is wrong.

Regarding why it happens on OSMC, it could be a glibc bug. Bullseye may remedy this.

My guess is you return 0 somewhere in your code, and it’s passed to std::string.

Since this works on my Ubuntu desktop install the only thing I can think of is the below call to play the YouTube video. I pass the path as a variable and I am pretty sure this is when it crashes…

xbmc.executebuiltin(‘PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=’ + path + ‘)’)

Well – try remove that line and verify if that’s the case.
Maybe check that videoID etc is sanitised properly.

some updates here. Thought it could be lack of ram so I installed on a pi4 with 4 GB but same bahvior - osmc crashed as soon as addon tries to execute the below line

xbmc.executebuiltin('PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=' + path + ')')

Tried on Libreelec fresh install - same issue - it crashes

Strange thing about this is that it works on my Ubuntu Desktop Kodi

Will keep researching

Ok for future reference I just replaced

PlayMedia

With

RunPlugin

And it just worked…

dont mean to dwell on this but the final solution is I actually used the below command to pass the video URL for Kodi to play

xbmcplugin.setResolvedUrl(_HANDLE, True, listitem=play_item)

The URL for the youtube video should look like this (replace YoutubeID with the ID of the video from youtube)

plugin://plugin.video.youtube/play/?video_id='+YoutubeID

no crashes of Kodi anymore and it plays the video with no issue on my Pi 3 osmc