[Shutdown] Can falsely report that recordings or timeshift save is running

Issue #713 resolved
prl created an issue

If the user enables MENU>Setup>TV>TImeshift settings>Stop timeshift while recording, and a recording is made while the PVR is in normal run state, Standby.TryQuitMainloop() will incorrectly act as though a timeshift save is being run when it is not.

  • If config.timeshift.stopwhilerecording.value is disabled (the default) the body of Components.Timeshift.InfoBarTimeshift.ptsTimerEntryStateChange() is not executed.
  • If the body of ptsTimerEntryStateChange() runs, the test len(JobManager.getPendingJobs()) >= 1 is not specific enough to only test whether timeshift saving jobs are running. Specifically, in this case there is a job running just after the recording finishes, the one that cleans out the trash folders, and that means that the job count is greater than 0 when this code runs.
  • That results in config.timeshift.isRecording being set to True when it should be False.
  • config.timeshift.isRecording being incorrectly set to True causes the shutdown code to incorrectly think that there are current timeshift save jobs being run, so it displays the "Recording(s) are in progress or coming up soon, or you are saving timeshift!" popup. It doesn't display the "N jobs are running in the background!" message for two reasons: by the time POWER is pressed on the remote, the trash cleanup job has finished, and even if it hasn't, the "Recording(s)" message takes priority over the "jobs" message.
  • The bug doesn't affect recordings made in standby from shutdown, because the relevant part of ptsTimerEntryStateChange() is not executed if the box is in standby.

The fix is probably to correct the test at the beginning of ptsTimerEntryStateChange(), and to make all tests on

len(JobManager.getPendingJobs()

in Components.Timeshift to be on

`len((j for j in JobManager.getPendingJobs() if j.__module__ == "Tools.TimeShift")) instead.

All of the Jobs/Tasks used to do timeshift saves are defined in Tools.TimeShift. Using the job names would be cumbersome.

Replication steps

At a time when no other recordings are expected to run:

Enable MENU>Setup>TV>TImeshift settings>Stop timeshift while recording.

Reboot or restart GUI

REC>Create instant recording and set a conveniently short record time (e.g. 1 min)

Wait for the recording to complete

long-POWER>Shutdown, incorrectly get ""Recording(s) are in progress or coming up soon, or you are saving timeshift!"" popup.

Comments (3)

  1. Peter Urbanec

    Fix Bug #713: [Shutdown] Can falsely report that recordings or timeshift save is running

    [Timeshift] Limit tests on the job queue to jobs initiated by Components.Timeshift. This then fixes the bug by having InfoBarTimeshift.ptsTimerEntryStateChange() only set config.timeshift.isRecording to True if there are time-shift related jobs in the job queue.

    Other places in the timeshift code should also only be testing for time-shift related jobs in the job queue.

    → <<cset 31983bd5d202>>

  2. Log in to comment