[mythtv] Auto shutdown occurs while transcode/commflag job is in progress (bad idle detection)
Matt Doran
matt.doran at papercut.biz
Sun Apr 15 23:57:02 UTC 2007
Chris Pinkham wrote:
> * On Sun Apr 15, 2007 at 06:47:15PM +1000, Matt Doran wrote:
>
>> Possible work-arounds are:
>>
>> * Increase the idle timeout. This will mean that
>> "CheckShutdownServer()" is called less often, which will reduce
>> the likelihood of incorrect shutdown.
>> * Reduce the "JobQueueCheckFrequency" from the default of 60
>> seconds. This will reduce the time between one job completing
>> and the next job starting, which will reduce the likelihood of
>> incorrect shutdown.
>>
>
> You missed the obvious one:
>
> * Make CheckShutdownServer() or whatever code actually gets executed
> check for pending jobs in the JobQueue.
>
>
Doing that is the best way ... but it's a little tricker because you
also need to take into account the other intricacies of the job queue.
For example, are we in the "Job Queue Window"? If we don't take this
into consideration we could stop a shutdown because there are pending
jobs, but they're never going to be started.
The code that does the checks is in "mythshutdown". It uses a
"getStatus()" method which returns a different status depending on what
the backend is doing. e.g.
-s/--status (returns a code indicating the current status)
0 - Idle
1 - Transcoding
2 - Commercial Flagging
4 - Grabbing EPG data
8 - Not used
16 - Locked
32 - Not used
64 - In a daily wakeup/shutdown period
128 - Less than 15 minutes to next wakeup period
If I were to develop a patch for this, how does this sound:
* Add a new test to GetStatus() to check for pending jobs (if not in
the job window, we treat it like no jobs are pending)
* Return status "32" (currently not used) to indicate there are jobs
pending.
Thoughts? Is this the best approach?
Thanks,
Matt
More information about the mythtv-dev
mailing list