Kodi v17 Playback crash on "Pause"

Hi guys. Same problem here. It is really annoying. I use official BT dongle (tried also th built-in RPi3 one. Didn’t help). I didn’t replace the files with ones from git.

My logs: http://paste.osmc.io/qosotadari

I think the problem is somewhere around here:

19:09:00.178 T:1630655472   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: 'NoneType' object has no attribute 'Pause'
                                            Traceback (most recent call last):
                                              File "/usr/share/kodi/addons/service.osmc.btplayer/service.py", line 200, in onPlayBackPaused
                                                self.btPlayer.pause()
                                              File "/usr/share/kodi/addons/service.osmc.btplayer/service.py", line 169, in pause
                                                self.player.Pause(dbus_interface=PLAYER_IFACE)
                                            AttributeError: 'NoneType' object has no attribute 'Pause'
                                            -->End of Python script error report<--

I believe this is fixed in this commit:

Hi @sam_nazarko,
thanks for support!
I’ve just copied file and unfortunately fix doesn’t work for me :frowning:
same behavior
Regards,
Max

Hi, I have been away from my pi for a month. Now I have replaced service.py with the patched version from git and the problem still occurs. I have replaced the file a few days ago and used the pi several times (multiple shutdowns and restarts meanwhile). I uploaded logs with replaced service.py

http://paste.osmc.io/ipowejeseg

I believe, the problems start somewhere around 18:11.

@sam_nazarko, will you please look at the issue? There is obviously something else stopping the playback, while the fix didn’t help.

@livin, @matejmosko, @gezb, @sam_nazarko

Did this issue get fixed for you guys?
It has not for me and Im at the point where Im giving up on standing up and restarting my devise every time I pause a video.

I did start a new thread with this issue to try to pump life in to it again, but with no results

Regards,
Hedinn

Hi @hedinn

Sorry – but we struggled to reproduce this problem. If the issue can be reproduced locally we might be able to investigate further.

Do you experience the problem without BTPlayer?

Hi @hedinn, hi @sam_nazarko
I read release notes for august release and was hoping the issue is fixed (“Fix for a possible crash when using ALSA for audio output”).
But it does not change behavior in my case - still crash on pause after 1-2 mins.

That’s a Kodi fix.

Sorry – but because we can’t reproduce the problem we’re not sure how to fix it.
If you are familiar with how to use gdb we may be able to get a backtrace.

Hi guys, thanks for your inputs

I don’t think my issue is with BTPlayer @sam_nazarko. I don’t have a BTPlayer add-on and Im not using any bluetooth devise with my RP3.

However I see in my log:

18:34:49.136 T:1958592512 DEBUG: CPlayerCoreConfig::: created player BTPlayer

In my logs around the time my system freezes, I see this line.

18:57:08.380 T:1458193392 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer

Here are two log where I my system has frozen:
https://paste.osmc.tv/zelacemowi
https://paste.osmc.tv/etitigimad

@livin I was hoping that the august update would fix the problem, since basically only changes I made to my setup from being standard is with ALSA. I have a HiFi Berry module. But unfortunately the august update did not fix my problem either.

@sam_nazarko Im going to familiarise myself with GDB and hopefully give you better data.

Regards,
Hedinn

Does removing the HifiBerry module improve stability?
Really it depends on how often you can reproduce the problem. If it goes away sans HifiBerry that would be interesting.

I can always reproduce the issue. Always when I press pause and start again it freezes.

I did a quick test just now and put my sd card into another RP3 that I have, and does not have HiFi Berry and the issue did not happen then, so the problem must be with the HiFi Berry :frowning:

Just for info I have the HiFi Berry Digi+ Pro

I have no HiFi berry, just streaming to jbl charge using usb bluetooth dongle

This is probably another issue than the one described above. We are not talking about the freeze. The issue is just playback crashing after the video has been paused.

  1. Play video
  2. Pause it
  3. Wait for a moment
  4. The video stops and OSMC gets back to list of videos

Workaround for this issue is disabling BTPlayer. Look here: Kodi v17 Playback crash on “Pause” with BT speaker · Issue #367 · osmc/osmc · GitHub

Hi All,
the issue is definitely in btplayer. I’ve disabled it through UI and have no kodi crashes anymore. Meanwhile streaming I need (kodi => bluetooth => jbl charge) works fine.
@sam_nazarko @matejmosko @gezb

IIRC, you can’t actually disable BTPlayer, so I’m not sure if it’s that.
I don’t know why only a few people can reproduce the problem.

Can you reproduce it on demand? Then we could debug the problem.

Sam

hi @sam_nazarko
the funny thing you can’t disable btplayer using “Disable” button in addon settings, but using “Configure” button you can - there is check box (slider) “Enable” inside. Now I have only “My OSMC” and “Updates” in add-ons\Running


Regards,
Max

I need to fix that so it can’t be disabled without manual removal.

Sam

it’s better to have a fix rather for crash than for disabling :smiley:
can you say how to enable/disable it from command line?
thx

Hi @sam_nazarko
finally I find a time to have a look inside of service.py of btplayer.
So the issue in line 145:

elif iface == "MediaTransport1":
        if "State" in changed:
            if not changed["State"] == self.state:
                self.state = changed["State"]
                if not self.state  == "active":
                    xbmc.stopBTPlayer()

When I started video first time the condition

if not self.state  == "active"

returned false

Then I pressed pause, after 1-2 mins it run stopBTPlayer where same condition gave true and kodi crashed on xbmc.stopBTPlayer()

I extended the code with log messages

    elif iface == "MediaTransport1":
        if "State" in changed:
            log("Enter 1")
            if not changed["State"] == self.state:
                log("Enter 2")
                self.state = changed["State"]
                if not self.state  == "active" and xbmc.isBTPlayerActive():
                    log("Enter 3")
                    xbmc.stopBTPlayer()
                    log("Enter 4")

and got following:

15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 1
15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 2
15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 3
15:14:49.706 T:1958653952   DEBUG: CGUIWindowManager::PreviousWindow: Deactivate
15:14:49.706 T:1958653952   DEBUG: ------ Window Deinit (VideoFullScreen.xml) ------
15:14:49.727 T:1958653952   DEBUG: CGUIWindowManager::PreviousWindow: Activate new
15:14:49.727 T:1958653952   DEBUG: ------ Window Init (Home.xml) ------
15:14:49.780 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/video/]: refreshing..
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/audio/]: refreshing..
15:14:49.781 T:1913648112   DEBUG: Thread JobWorker start, auto delete: true
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/executable/]: refreshing..
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/image/]: refreshing..
15:14:49.789 T:1642066928   DEBUG: Thread JobWorker start, auto delete: true
15:14:52.478 T:1958653952  NOTICE: CVideoPlayer::CloseFile()
15:14:52.478 T:1958653952  NOTICE: VideoPlayer: waiting for threads to exit
15:14:52.478 T:1419740144  NOTICE: CVideoPlayer::OnExit()
15:14:52.478 T:1419740144  NOTICE: Closing stream player 1
15:14:52.478 T:1419740144  NOTICE: Waiting for audio thread to exit
15:14:52.479 T:1316668400   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true
15:14:52.479 T:1316668400  NOTICE: thread end: CVideoPlayerAudio::OnExit()
15:14:52.479 T:1316668400   DEBUG: Thread VideoPlayerAudio 1316668400 terminating
15:14:52.479 T:1419740144  NOTICE: Closing audio device
15:14:52.479 T:1419740144   DEBUG: CDVDAudio::Flush - flush audio stream
15:14:52.480 T:1934033904   DEBUG: CActiveAE::DiscardStream - audio stream deleted
15:14:52.480 T:1934033904   DEBUG: CActiveAE::ClearDiscardedBuffers - buffer pool deleted
15:14:52.483 T:1419740144   DEBUG: Previous line repeats 3 times.
15:14:52.483 T:1419740144  NOTICE: Deleting audio codec
15:14:52.483 T:1419740144  NOTICE: Closing stream player 2
15:14:52.484 T:1419740144  NOTICE: waiting for video thread to exit
15:14:52.484 T:1325057008   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true
15:14:52.484 T:1325057008  NOTICE: thread end: video_thread
15:14:52.484 T:1325057008   DEBUG: Thread VideoPlayerVideo 1325057008 terminating
15:14:52.486 T:1419740144  NOTICE: deleting video codec
15:14:52.493 T:1411351536   DEBUG: Thread FileCache 1411351536 terminating
15:14:52.504 T:1419740144   DEBUG: OnPlayBackStopped: play state was 2, starting 0
15:14:52.508 T:1419740144   DEBUG: Thread VideoPlayer 1419740144 terminating
15:14:52.508 T:1958653952  NOTICE: VideoPlayer: finished waiting
15:14:52.508 T:1958653952   DEBUG: DeleteRenderer - deleting renderer
15:14:52.508 T:1958653952   DEBUG: CMMALRenderer::~CMMALRenderer
15:14:52.508 T:1958653952   DEBUG: CMMALRenderer::UnInitMMAL
15:14:52.533 T:1958646768   DEBUG: CAnnouncementManager - Announcement: OnStop from xbmc
15:14:52.533 T:1958646768   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnStop
15:14:52.539 T:1299891184   DEBUG: CMMALRenderer::Process - stopping
15:14:52.539 T:1299891184   DEBUG: Thread MMALRenderer 1299891184 terminating
15:14:52.558 T:1958653952   DEBUG: CMMALPool::~CMMALPool Destroying pool 0x5b468f00 for port vc.ril.video_decode:out:0(OPQV)
15:14:52.562 T:1308279792   DEBUG: CMMALRenderer::Run - stopping
15:14:52.562 T:1308279792   DEBUG: Thread MMALProcess 1308279792 terminating
15:14:52.563 T:1523577840   DEBUG: BTPlayer: Enter 4 xbmc.stopBTPlayer()

kodi crash happened exactly on

15:14:52.484 T:1325057008   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true

I also tried to extend else condition to xbmc.isBTPlayerActive() and had no more crash

elif iface == "MediaTransport1":
        if "State" in changed:
            if not changed["State"] == self.state:
                self.state = changed["State"]
                if not self.state  == "active" and xbmc.isBTPlayerActive():
                    xbmc.stopBTPlayer()

Unfortunately my knowledge of xbmc and dbus is close to zero, so if you have any ideas please help

Thanks!
cc @gezb @matejmosko