PVR OnWake
#1
Currently in the OnWake()  function the PVR calls the client OnSystemWake() and then proceeds to empty and repopulate the database no matter what state it is in.  It takes me about six seconds to resume and then another couple of minutes to load.  This makes no sense when I just step away from the PC for a short time.  Right now it is faster to exist Kodi, sleep and restart Kodi after the resume.

Would it not be better to NOT clear the database and let the table update work based on the system timers that were already being checked?

Martin
Reply
#2
The actual problem seems to that when the client comes back from sleep the NIC is not initially active so the calls from NextPVR to get the groups fails.  Before deleting the files Kodi should run GetStatus() to see if the backend is up.

Martin
Reply
#3
I really need some help coding a change on this.  I added a timeout and now my connections to the backend don't time out and channels don't get deleted but there is a problem with the Kodi code because the very first action logged that happens immediately on wake is the table updates which of course fails until the NIC resumes.
Code:
17:56:33.008 T:21668   DEBUG: Thread EPGUpdater start, auto delete: false.
17:56:30.479 T:19296   DEBUG: Thread PVRManager start, auto delete: false
....
18:30:52.432 T:7192   DEBUG: CAnnouncementManager - Announcement: OnSleep from xbmc
18:30:52.432 T:7192   DEBUG: GOT ANNOUNCEMENT, type: 8, from xbmc, message OnSleep
18:30:52.432 T:5956  NOTICE: CPowerManager::OnSleep: Running sleep jobs
18:30:52.432 T:5956   DEBUG: CApplication::CloseNetworkShares: Closing all network shares
07:35:35.205 T:21668   DEBUG: CurlFile::Open(0x2a606ef5f00) http://172.16.3.2:8866/service?method=channel.listings&channel_id=7608&start=1549370135&end=1549629335&sid=028ae7b5866f4bee98f4de2721883b7a
07:35:35.205 T:21668    INFO: XCURL::DllLibCurlGlobal::easy_acquire - Created session to http://172.16.3.2
07:35:35.213 T:21668   ERROR: CCurlFile::FillBuffer - Failed: Couldn't connect to server(7)
...
07:35:35.347 T:19296   ERROR: PVR::CPVRClient::GetTimers: Add-on 'NextPVR  (172.16.3.2):connected' returned an error: server error
07:35:35.347 T:19296   ERROR: PVR::CPVRClients::GetTimers: PVR client 'NextPVR  (172.16.3.2):connected' returned an error: server error
...
07:35:36.347 T:5956   DEBUG: WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC event was sent
...
07:35:40.691 T:5956    INFO: AddOnLog: NextPVR PVR Client: On NextPVR Wake 1 1
07:35:40.691 T:7192   DEBUG: CAnnouncementManager - Announcement: OnWake from xbmc
07:35:40.691 T:7192   DEBUG: GOT ANNOUNCEMENT, type: 8, from xbmc, message OnWake

The EPG and tables update threads need to be locked until after the OnSystemWake() to allow connections to the backend to open.  The current delete all seems to fake this out by emptying the groups but I don't want to force an update since the saving the reload was the purposed of my attempted change

Martin
Reply
#4
After some testing I think the PVR OnWake function needs to be re-worked to be controlled.   A couple of addons use it to wake the back end but ultimately the issue of the connection being temporarily lost at startup after wake cannot safely be handled with the current logic.  I will open an issue on this.

Martin
Reply
#5
Anyone have thoughts on this?  Users are complaining about crashing and I can understand that given that all the OnWake logic is happening assuming that the connection is solid, and there are lots of collisions with updates and re-connections after the  client wakes because the NIC is still not available for some time.  I avoided some collisions by disconnecting allowing re authentication and WOL but that doesn't alway stop Kodi from continuing through the all the OnWake() functions.

Martin
Reply

Logout Mark Read Team Forum Stats Members Help
PVR OnWake0