MythTV add-on for Kodi hangs at 0%

Around about the 26/3/2021 the Windows 10 MythTV add-on for Kodi stopped working. I had seen similar problem before, Kodi MythTV addon fails to load except this time it didn’t load at all whereas previously it was stuck loading at around 40%.

This time around it didn’t seem to connect to the MythTV server at all. When I tried to look at recordings, channels or recordings it just showed “PVR manager is starting up: 0%” with the spinning wheel to the right. It didn’t matter how long you waited it didn’t change.

Looking in the Kodi log, with extra add-on debugging, there was no indication of what was wrong.

This whole time MythTV server worked fine. It recorded programs fine, I could watch recordings from MythWeb. I could connect fine from Kodi on my Android phone, I could even run Myth front end, from the MythTV server, without any problems.

My MythTV setup

My setup is described in MythTV on CentOS 7 with the infrastructure looking like:

Diagnostics

I looked at my notes from the previous similar error and tried the ideas from it, but it didn’t make any difference.

I have a daily backup of MythTV, including the database and file system. However because of my workload at work I didn’t get to look at the issue until over a week after the problem occurred so I didn’t have a backup just prior to the problem happening so I had to go back to my next most recent backup on 7/6/2020 – nearly a year old.

Rolling back the DB nearly a year resolved the problem – fantastic.

Next I went to a backup just prior to the problems, this was dated 30/March/2021. This also worked correctly. So clearly something happened in the DB between the 30th and now.

It was great the earlier backups worked, but it didn’t explain the problem and didn’t give me any clues about what to do if it came up again or what to do to prevent it. Not to mention I would have lost a years recordings.

I tried the following, individually, but none of them made any difference:

  • Cold start of SonicWall
  • Cold start of ESXi host
  • Stop Start of VM – as part of cold restart of ESX
  • Cold restart of NetGear managed switch

Kodi versions

Kodi 17, kodi-17.6-Krypton-x86.exe, which is 32 bit, works. However it doesn’t show existing recordings but live TV and recorded live TV work.

Kodi 18 and 19 do not work. Kodi 18.6 32bit also doesn’t work.

Testing strategy

Because I didn’t want to break anything I stopped my MythTV VM server and moved the image under /Current_Working_20210405″ and then copied the VM folder to the original location. This ensured if there were any issues with copying the VM folder it would only impact the test instance of the VM.

Secondly my recordings are on two NAS servers “NAS1” and “NAS2”. I renamed the existing “recordings” folder to “recordings – Current Recordings” and created a new folder called “recordings”.

My primary Kodi device is the lounge PC. I tried to not use this but to rather use my desktop PC to check if things were working. This is because there is quite a bit on the filesystem of Kodi and it’s associated SQLite database. If you must use your equivalent of my lounge computer then ensure you backup everything under the following folders:

  • C:\Users\Tony\AppData\Roaming\Kodi
  • C:\Program Files\Kodi

So between the above measures I was able to test ideas with the confidence my original setup was intact.

The resolution

It seemed clear that the problem was in the database rather than the supporting infrastructure. The question was what was wrong.

At this point I worked I was running the test VM which had a current copy of the database.

I began by truncating all the tables that I thought might be related. Then once I found the effected tables I reduced the tables to be truncated to the bare minimum to resolve the problem

Then rather than truncate I started deleting rows in the tables based on date – because it only stopped working at a particular date. This worked and I was able to reduce it to 3 tables and a handful of records

The working query is below. Obviously you would have to work out the specifics for your environment:

delete from mythconverg.record where recordid in (1157);
delete from mythconverg.program where starttime in ('2021-04-04 11:30:00');
delete from mythconverg.recorded where starttime  > ('2021-04-01 00:00:00');
commit;

For your info the rows that are being deleted look like the below. I have not been able to see any invalid or special characters that might cause a problem:

select * from mythconverg.record where recordid in (1157);
1157	4	0	08:00:00	2017-08-01	08:30:00	2017-08-01	Shortland Street		Jack meets a charmer. Michael's tempted to break the law. Nicole loses her grip.	0	0	Film	Default	10	1	6	1	3	25	Default	8	15		crid://tvnz.co.nz/1026619	crid://tvnz.co.nz/10469604		0	0	0	0	0	0	0	0	3	20:00:00	736907	0	0	0	Default	0	2021-04-05 06:57:00	2021-04-01 11:56:55	2021-04-01 12:53:54	Default	184	0	1

select * from mythconverg.program where starttime in ('2021-04-04 11:30:00') and title like '%Inside%';
1016	2021-04-04 11:30:00	2021-04-04 12:00:00	Inside Story		G Beyond the headlines to the heart of the news of the day. Al Jazeera gets the Inside Story from some of the best minds in the Middle East and beyond.		series	0	0.0	0		0	0	0	0	0	0	crid://www.aljazeera.com/15241971					crid://www.aljazeera.com/44546130	0	0	1	0	0					0	0	0

select * from mythconverg.recorded where starttime  > ('2021-04-01 00:00:00');
1002	2021-04-01 11:57:00	2021-04-01 12:50:05	Shortland Street		PG Marty struggles to find a solution. Dawn marks her territory. Zara signs out.	0	0	Movie	mythsvr2	0	0	0	1	0	Default	1157	crid://tvnz.co.nz/1031826a	crid://tvnz.co.nz/10590196		2021-04-02 01:50:05	2882862312	0.0	0		0	0	0	0	1.0	10	1002_20210401115700.ts	2021-04-01 12:00:00	2021-04-01 12:25:00	Default	Default	1	0	0	Default		1	2030	Input 1
1003	2021-04-02 04:57:00	2021-04-02 06:04:06	Newshub Live At 6pm		Newshub Live At 6pm presents comprehensive coverage of global and local news.	0	0	Entertainment	mythsvr2	0	0	0	1	0	Default	1394	crid://tv3.co.nz/68236	crid://tv3.co.nz/t1048718		2021-04-02 19:04:06	3711027128	0.0	0		0	0	0	0	1.0	0	1003_20210402045700.ts	2021-04-02 05:00:00	2021-04-02 06:00:00	Default	Default	1	0	0	Default		1	2033	Input 2
1002	2021-04-03 05:27:00	2021-04-03 07:34:05	Movie: Oddball		An eccentric chicken farmer, with the help of his granddaughter, trains his dog to protect a penguin sanctuary from fox attacks in an attempt to reunite his family and save their seaside town. (2015)	0	0	Movie	mythsvr2	0	0	0	0	0	Default	1907		crid://tvnz.co.nz/10477867		2021-04-03 20:34:05	5912729908	0.0	0		0	0	0	0	1.0	0	1002_20210403052700.ts	2021-04-03 05:30:00	2021-04-03 07:20:00	Default	Default	1	0	0	Default		1	2035	Input 1
1003	2021-04-03 04:57:00	2021-04-03 06:04:05	Newshub Live At 6pm		Newshub Live At 6pm presents comprehensive coverage of global and local news.	0	0	Entertainment	mythsvr2	0	0	0	1	0	Default	1394	crid://tv3.co.nz/68236	crid://tv3.co.nz/t1048719		2021-04-03 19:04:05	3683758480	0.0	0		0	0	0	0	1.0	0	1003_20210403045700.ts	2021-04-03 05:00:00	2021-04-03 06:00:00	Default	Default	1	0	0	Default		1	2034	Input 2
1003	2021-04-02 03:42:00	2021-04-02 04:29:05	Travels With The Bondi Vet		G New Episode. Chris goes on the celebrity trail in LA, explores a mysterious ocean outcrop in his quest to become James Bond and visits a wildlife forest in the heart of Dublin. S3 Ep1	0	0	Entertainment	mythsvr2	0	0	0	0	0	Default	357	crid://tv3.co.nz/67892	crid://tv3.co.nz/t1042608		2021-04-02 17:29:05	2866085568	0.0	0		0	0	0	0	1.0	0	1003_20210402034200.ts	2021-04-02 03:45:00	2021-04-02 04:15:00	Default	Default	1	0	0	Default		1	2031	Input 1
1008	2021-04-01 07:57:00	2021-04-01 08:40:05	Grand Designs NZ: Signature Series		PG A site with a river running through it would put most people off. But not Harlem and Nicola who attempt to build a glass-house on a bridge over the water. S5 Ep2	0	0		mythsvr2	0	0	0	0	0	Default	169	crid://tv3.co.nz/56196	crid://tv3.co.nz/t786095		2021-04-01 21:40:05	963187544	0.0	0		0	0	0	0	1.0	0	1008_20210401075700.ts	2021-04-01 07:30:00	2021-04-01 08:30:00	Default	Default	1	0	0	Default		1	2029	Input 1
1008	2021-04-02 04:42:00	2021-04-02 05:29:05	Travels With The Bondi Vet		G New Episode. Chris goes on the celebrity trail in LA, explores a mysterious ocean outcrop in his quest to become James Bond and visits a wildlife forest in the heart of Dublin. S3 Ep1	0	0	Entertainment	mythsvr2	0	0	0	0	0	Default	357	crid://tv3.co.nz/67892	crid://tv3.co.nz/t1042608		2021-04-02 18:29:05	1222027448	0.0	0		0	0	0	0	1.0	0	1008_20210402044200.ts	2021-04-02 04:45:00	2021-04-02 05:15:00	Default	Default	1	0	0	Default		1	2032	Input 1

Daylight savings – possible cause

Now I have a resolution that worked for me today, I still can’t absolutely say what caused the issue. Essentially I have to delete the most recent details in 3 tables, so it stinks of being a time related issue.

The previous similar problem seems somewhat similar and after cleaning up the tables, in that instance, things worked again. And for that case the table that was truncated was the “program” table, which is one of the 3 tables we found this time around

I documented the previous problem around November 3 last year. Daylight savings began on 27 of September 2020. Daylight savings ended April 4th 2021.

My problems this time around occurred around the 26/4/2021 with daylight savings just slightly over 8 days away on the 4/4/2021. This ties in with the EPG because the EPG holds roughly 8 days of details, so potentially EPG issues could potentially show up 8 days before the recording.

Help

Kodi MythTV Forum
https://forum.kodi.tv/forumdisplay.php?fid=170