djp952 / pvr.hdhomerundvr

Unofficial Kodi HDHomeRun DVR PVR Client
https://github.com/djp952/pvr.hdhomerundvr/wiki
Other
58 stars 9 forks source link

Constant looploops on channel scan during startup in Kodi 18 Leia #56

Closed leopheard closed 4 years ago

leopheard commented 5 years ago

After updating to Kodi 18, it appears this addon is causing a bootloop during bootup channel scan.

Is there any way in which to get this addon to run other than reinstalling with Kodi 17?

Log from /home/.kodi/temp shows:

2019-05-30 00:12:23.505 T:1076855520 NOTICE: ADDON: xbmc.webinterface v1.0.0 installed 2019-05-30 00:12:23.826 T:1174401760 NOTICE: PVR Manager: Stopping 2019-05-30 00:12:24.081 T:1916368432 WARNING: CGUIMediaWindow::OnMessage - updating in progress 2019-05-30 00:12:24.421 T:1174401760 NOTICE: PVR Manager: Stopped 2019-05-30 00:12:24.424 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: zuki.pvr.hdhomerundvr v2.0.1 loading 2019-05-30 00:12:24.424 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: user data directory /home/osmc/.kodi/userdata/addon_data/pvr.hdhomerundvr/ does not exist 2019-05-30 00:12:24.424 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: user data directory /home/osmc/.kodi/userdata/addon_data/pvr.hdhomerundvr/ created 2019-05-30 00:12:24.663 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: initiating local network resource discovery (startup) 2019-05-30 00:12:25.441 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: discovered: HDHomeRun EXTEND 1058F3EC 2019-05-30 00:12:25.495 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: delaying startup discovery task for 3 seconds 2019-05-30 00:12:25.495 T:1174401760 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: ADDON_Create: zuki.pvr.hdhomerundvr v2.0.1 loaded 2019-05-30 00:12:26.075 T:1174401760 NOTICE: AddOnLog: PVR HDHomeRun Client: ADDON_Create - Creating the PVR HDHomeRun add-on 2019-05-30 00:12:27.137 T:1174401760 NOTICE: PVR Manager: Starting 2019-05-30 00:12:27.535 T:1135604448 NOTICE: PVR Manager: Started 2019-05-30 00:12:27.536 T:1110426336 NOTICE: EPG thread started 2019-05-30 00:12:28.496 T:1085248224 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_startup_task: initiated startup discovery task

djp952 commented 5 years ago

Hi! Saw your post on SD forums and replied there primarily, but will (as promised) copy/paste the relevant parts here:

As for the bootloop, and I am going to reply on GitHub as well later for you and likely just copy/paste this (lol), but ... the Krypton version of the addon shouldn't have loaded at all under Leia, OSMC should have errored out on startup with a banner message along the lines of "unable to load addon". The addon tells Kodi what versions of the internal interfaces it needs, and they won't match across major Kodi versions like this. If OSMC somehow managed to bypass this (which would be weird), it would almost undoubtedly crash Kodi since the interfaces are different, so the addon would be calling into essentially random addresses and go boom.

I'm glad it's working for you now, but I think my main question would be if you did get this error from OSMC about an incompatible addon or not after the upgrade. If it allowed an incompatible addon to load, that's something we should bring to OSMC's attention.

Linux-based addons are a bit more fussy than the other platforms as well. There is no in-built protection from loading an addon built for another architecture. In fairness, that was new in Leia for the other platforms, and I only recently took advantage of that (upcoming in v2.1.0) so if you say tried to install the x86 Windows addon on x64, Kodi just says no. Linux has nothing like that, it's all just "linux" to Kodi.

I would like to leave this issue open for a bit, even though you are up and running. I'm concerned that OSMC may have allowed the incompatible addon to load at all, and if there is something I can do to prevent that from happening to others, I would like to!

leopheard commented 5 years ago

So, both instances of Kodi have been running fine since I deleted all the folders with pvr. in them. It does seem Kodi 18 allowed the old/incompatible addon to be run when it shouldn't.

Also, does this work with the DVR? It doesn't show any recordings in the interface itself, but going to the recordings folder it does seem to be recording I think

djp952 commented 5 years ago

Unfortunately, I'm literally headed out of town for an entire week in about 6 hours. Would you mind asking for some help over at the SiliconDust forums? Many of those folks have been using this addon since day one, they are a pretty helpful crew :)

It definitely works with the DVR service and recordings, it's kind of my claim to fame as it were - lol. I apologize for not being able to help you out right now, but if you haven't gotten any resolution by the time I get back, I assure you we will get you up and running all the way!

jlippold commented 5 years ago

Im seeing this same problem, also so is this guy on the forums https://forum.silicondust.com/forum/viewtopic.php?f=88&t=71135&sid=4d8f3fc9b6bdc9fa526c7b1d9b19231f&start=135#p346310

For me the problem occurs with OSMC. There are no crash logs in kodi.log, and it reboots at each channel scan

djp952 commented 5 years ago

Acknowledged. Are you running version 2.0.2 or 2.0.3 of the PVR add-on? There was a bug in v2.0.1 and earlier that could cause a crash like this.

I tried my LibreELEC box a few minutes ago and it was OK running v2.0.3. Not scientific or conclusive, we were away for a week so this machine hasn't been used in like 12 days -- one boot and EPG load is far from an exhaustive test :)

I have to get an update out ASAP due to a back end API change that is preventing timers from being manipulated but will try to figure this out for you guys and get any necessary code fix into that build.

Sorry for the annoyance! Linux is always more difficult to fix for me.

djp952 commented 5 years ago

Updating to version 2.0.3 has been reported as resolving this problem in at least one case. I think that's going to be the general pattern here, that silly old bug from forever ago seems to be rearing it's ugly head more and more for people. I see in the original log above that this was originally a v2.0.1 problem as well.

Please keep me informed if you are still having problems on v2.0.3 (or after later today v2.0.4 due to the quick-fix that needs to be applied).

FWIW, version 2.1 of the addon will finally be able to support auto-updates on Linux systems. My hope is that as bugs are found that don't affect everyone an update can go out to resolve it before it becomes a debacle.

jlippold commented 5 years ago

Thanks for the help @djp952. Unfortunately, i was running the latest off my rpi3/OSMC zuki.pvr.hdhomerundvr-linux-armhf-leia-2.0.3.7079

djp952 commented 5 years ago

Thanks for checking that. I'll get OSMC set up again and take another crack at this one

djp952 commented 5 years ago

Alright sir, I got the latest OSMC (OSMC_TGT_rbp2_20190522.img.gz) installed clean on my RPi 3 (B+, I believe this is my newer one), installed version 2.0.3 of the PVR using the same .zip file, and ... nothing. No crashes at all :(

Here's where my head is at -- there could be something about your specific channels or OSMC setup that could be triggering the problem. If you are willing to try this, it may be possible for me to use your ~/.kodi directory on my device. That should copy all of your addons and settings as they are, theoretically proving/disproving that it's a code specific issue. If I use your exact setup and I still don't crash, I think we can start looking more at a data specific issue.

Sharing potential PII by dumping that directory may be premature still, I will play around with OSMC and try to throw it some problems first to see if I can get it to do anything like you are describing.

I'll let you know!

jlippold commented 5 years ago

Hey @djp952 thanks for the feedback.

It's so odd that there's nothing in the crash log, but if I disable the addon the crash stops. My setup probably won't transfer to you so easily because I use Emby as a backend. Is there any other way I can help you test it? I could give you SSH and VNC access temporarily?

djp952 commented 5 years ago

That's an interesting point I hadn't considered, I wonder if I have some kind of problem that is triggered by the presence of Emby?

Would you mind me asking for a brief description of how you are set up with that? I haven't used that addon before, the description implies that it "effectively replaces" the Kodi media databases ... the EPG gets stored in a media database. I have my doubts that there is any overlap for PVRs and the Emby addon, but it's absolutely worth my time to get something set up for you here.

SSH/VNC is probably not that useful quite yet, since I wouldn't be able to do much that you can't -- let me introduce a defect into the PVR that crashes OSMC and see where the objective evidence we really need goes (if there is any at all). Ideally we need something that points out the exact module and address where the fault occurred.

jlippold commented 5 years ago

Yea so emby is the server, it collects all the media information, imagery, actors, file paths etc. The pi's are the clients. So on the client, the emby kodi addon synchonizes the data between it's local kodi database and the emby server. So you get all the benefits of having a regular install, but all the data is managed centrally in emby. Including syncing what was watched and resume playback point.

The kodi emby addon does not have Live TV syncing, although Emby server does support live TV via HD Homerun.

Let me know if there's anything you need from me to help you debug. In the meantime, I'm using the other kodi pvr plugin which doesnt have all the nifty features that you have :)

djp952 commented 5 years ago

We could start with some process of elimination? I set up an Emby server and set up the addon in Kodi, no problems at all. It was worth a shot.

If you have time, you can try installing one of these .zip files (in the "noepg" folder under the link)

https://1drv.ms/f/s!AgEGEEVzGNq-i_o1GjMLlDTMA53KYQ

I built a one-off PVR that does not try to go get any EPG data at all. If this doesn't crash then we can be certain that the problem is in the EPG load. Of course you won't have any guide data, but you know, troubleshooting ...

Also of note is that you might want to try the "raspbian-armhf" flavor of the PVR. I've included both linux-armhf and raspbian-armhf at the link above. The raspbian build targets an older version of the ARM chip but otherwise should work the same. I don't expect any difference in behavior on OSMC on a RPi 3, but it does use the official Raspberry Pi compiler, so you never know!

If/when you have time to play, give those .zips a shot and let me know. If you can turn on Debug logging in Kodi and send the ~/.kodi/temp/kodi.log file that may help too, especially if these builds still crash. email is djp952 AT gmail.com.

If these DON'T crash, that's great and I can move the code block deeper and try to narrow this down. If these DO crash, then we are looking at a coincidence that it crashes during EPG load. There are all kinds of things the PVR and Kodi do simultaneously, especially at startup.

I'm hoping they don't crash myself :)

jlippold commented 5 years ago

So, I installed the latest from your repo first to see the crash again before trying your debug builds, and unfortunately the crash is no longer happening, which makes me believe it has to do with guide data that has now aged out.

So, I'll keep running the lastest stable and hope the crash happens again, so I can install the debug build. Could it be an text encoding issue somewhere? Just a thought.

djp952 commented 5 years ago

It's very likely the data at this point, or how I'm handling it. These things never happened when the EPG load was slow, so it's probably being truncated or getting some silent error either the cURL library or my code isn't handling well.

The next version has a check I put in to make sure the JSON data is 100% valid before trying to use it via the database engine (SQLite), so that may help. I would love to see the bad data first-hand and be able to crash the code in the debugger and be certain where the problem lies, but I've had the same problems -- whenever I have bad data coming from the back end, by the time I get set up to trap it, it's fine again.

The next time it happens, if you can send me your PVR database file, that will have your device authorization codes in there, which would allow me to spoof SD's backend (temporarily) into thinking I'm you. This is a mild privacy violation, of course, so let me try to explain exactly what this would allow me to do:

For as long as your tuner device authorization string(s) are valid (they persist up to 24 hours), if I use them from here I will get your guide data. I will also have access to your channel lineup, your recording rules, your e-mail address, and whether or not you pay for the DVR service. I will not have access to any payment information or any additional identifying data that I am aware of, other than your e-mail address. If I were to act maliciously, I could go as far as deleting or changing your recording rules, but I would not be able to affect your SiliconDust account in any way.

If you're OK with that, the files I would need are in ~/.kodi/userdata/addon_data/pvr.hdhomerundvr. If the PVR is running there will be 3 files, if the PVR is not there will be one file. The file I would need is hdhomerundvr-v2.0.db. Including the .db-shm and .db-wal files, if present, should be OK too (those are transaction log type files).

If you're not OK with that, that's totally cool too. I have been continuing to try and identify weaknesses in the new "fast" EPG code and bullet-proof them. It may even be solved in version 2.1.0 just by me adding the secondary JSON parser to make sure I don't throw SQLite a curve ball :) We will get there ... eventually! I appreciate your patience and willingness to live through reading my incessantly long responses :) Have a fantastic remainder of your weekend!

djp952 commented 5 years ago

FYI, I found another couple possible places that old bug I fixed recently (in 2.0.2) and they happen to be in the EPG code. Same stupid mistake. Can't be certain this is your bug, of course, but I'm going to see what conditions are necessary to hit these. One case is a lack of device authorization strings, which should be checked well before I get here.

Either way, it's something, and it would absolutely crash Kodi/OSMC if it was hit.

jlippold commented 5 years ago

ok, since it's not happening now, I'm good. Nevertheless, I'll stick on the older version to see if the bug appears again so we can know for sure.

djp952 commented 5 years ago

FYI, I had a Kodi crash on Windows today while the EPG was loading. Unfortunately I didn't have the symbol files loaded (using a nightly build from mirrors.kodi.tv) so I didn't get a clean call stack, but in this case I was able to tell that it was kodi.exe doing something with it's SQLite database. It's possible it was the EPG database, but I didn't have any way to see exactly what it was doing.

It's frustrating to get caught with one's pants down - it could have been exactly what we have been looking for. I'll of course keep vigilant to find it, if it happens on Windows for me while I am actually debugging it will become nice and obvious :)

djp952 commented 4 years ago

Hi jlippold, it's been a while on this one, how are we doing? I haven't seen any crashes since that one on Jun 28, but I haven't really been trying to make it crash either. Did Kodi 18.4 make any difference for you?

jlippold commented 4 years ago

It's been totally fine since that I posted last. Whatever it was, it hasn't happened again

djp952 commented 4 years ago

Alright .. I guess we can call this one closed due to lack of an ability to reproduce? Please don't hesitate to let me know if it starts happening again, or anything else weird starts going on, ok?

Thanks!!