google / sagetv

SageTV is a cross-platform networked DVR and media management system
http://forums.sagetv.com/
Apache License 2.0
267 stars 173 forks source link

SeriesInfo.java NullPointerException #383

Closed graywolfusmc closed 6 years ago

graywolfusmc commented 6 years ago

SeriesInfo.java NullPointerException error is causing write to wiz.bin to fail, leaving Wiz.bin.tmp Restarting clears this up but you lose anything done (recordings set, flag changes [watched, archived, etc.])

Can someone add code to prevent the NullPointerException from causing this issue and preventing the wiz.bin from getting written?

Thu 8/23 18:11:53.662 [EPG@11bd0e2] Wizard writing out table info for SeriesInfo Thu 8/23 18:11:53.906 [EPG@11bd0e2] Exception during Maintenance:java.lang.NullPointerException Thu 8/23 18:11:53.907 [EPG@11bd0e2] java.lang.NullPointerException Thu 8/23 18:11:53.907 [EPG@11bd0e2] at sage.SeriesInfo.write(SeriesInfo.java:201) Thu 8/23 18:11:53.907 [EPG@11bd0e2] at sage.Wizard.saveDBFile(Wizard.java:7930) Thu 8/23 18:11:53.907 [EPG@11bd0e2] at sage.Wizard.maintenance(Wizard.java:2369) Thu 8/23 18:11:53.907 [EPG@11bd0e2] at sage.EPG.run(EPG.java:645) Thu 8/23 18:11:53.907 [EPG@11bd0e2] at java.lang.Thread.run(Unknown Source) Thu 8/23 18:11:53.907 [EPG@11bd0e2] sage.epg.sd.SDRipper@df4c8 needs an update in 15:49:35 Thu 8/23 18:11:53.907 [EPG@11bd0e2] EPG needs an update in 949 minutes Thu 8/23 18:11:53.907 [EPG@11bd0e2] EPG's works is done. Waiting...

Narflex commented 6 years ago

Blocking that NPE may just then push the error to a different place. I'm not really sure how this could have happened in the first place...I'd also expect it to clean itself up after restarting since the database ensures all objects are 'valid' when it is loaded...and checking for nulls in the array causing the NPE is one of the validation steps. Is this still a problem for you, or did it just happen this one time?

wnjj commented 6 years ago

Hi Jeff, I built a debug jar for him to try that simply blocks any null people from being added to the seriesinfo in the first place. That way any other place that attempts to access it won't have an issue. The code change (along with a debug println is in this post: https://forums.sagetv.com/forums/showthread.php?p=616487#post616487

It seems simple and safe enough and the logging should help identify the offender.

wnjj commented 6 years ago

Now that I look again, I realized my fix is broken. It needs a different index for the 'series' array that counts only valid people.

wnjj commented 6 years ago

I updated the code in my post.

Narflex commented 6 years ago

Go ahead and upload a commit when you think you have it and I'll review it then. :)

wnjj commented 6 years ago

I'll wait for his test and after my 5-day camping trip. :)

wnjj commented 6 years ago

Original symptoms are in this thread: https://forums.sagetv.com/forums/showthread.php?t=65607

wnjj commented 6 years ago

Fixed in PR #391.