Opened 15 years ago
Closed 14 years ago
#6066 closed patch (fixed)
Wakeup time not set if Myth shuts down just before a scheduled recording
Reported by: | Owned by: | Isaac Richards | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | MythTV - Mythwelcome & Mythshutdown | Version: | head |
Severity: | medium | Keywords: | shutdown, wakeup |
Cc: | Ticket locked: | no |
Description (last modified by )
This might be related to #6019, but the symptoms are a bit different.
I have attached the full mythbackend/mythshutdown logs, but these extracts show the gist of the problem:
Backend log: 2009-01-03 10:13:52.191 Scheduler: Update next_record for 317 --- print list start --- Title - Subtitle Ch Station Day Start End S C I T N Pri Bratz - "Seje Filmstjerner" 3 TV2 03 10:20-11:25 1 1 1 S 1 1/0 [...] --- print list end --- 2009-01-03 10:13:52.245 Scheduled 111 items in 1.5 = 0.03 match + 1.42 place 2009-01-03 10:14:18.370 I'm idle now... shutdown will occur in 60 seconds. [...] 2009-01-03 10:15:18.021 Running the command to set the next scheduled wakeup time :- sudo /usr/local/bin/mythshutdown --setwakeup 2009-01-03T10:15:00 Mythshutdown log: 2009-01-03 10:15:18.652 recording scheduled at: 2009-01-03T10:15:00 2009-01-03 10:15:18.652 scheduled recording time has already passed. schedule deleted
So, in summary: The backend decides to shut down because the next recording is scheduled to start in 5 minutes and 50 seconds (my idleWaitForRecordingTime is 5 minutes). However, one minute later, when mythshutdown is called, it subtracts StartupSecsBeforeRecording? (set to 300 s = 5 min) and decides that it is too late to set the wakeup time. To make matters worse, it does not set the wakeup time to the next scheduled recording - it sets no wakeup time at all!
AFAICT, this will never happen as long as idleWaitForRecordingTime is at least a few minutes larger than StartupSecsBeforeRecording?, so as a workaround, I will set idleWaitForRecordingTime to ten minutes. A possible fix could be to enforce this.
Attachments (7)
Change History (20)
Changed 15 years ago by
Attachment: | backend.log added |
---|
comment:2 Changed 15 years ago by
I've attached two patches. 6060_1.diff is against the backend:
- Block shutdown if we're already past StartUpSecsBeforeRecording?. I'm not sure if I need to add StartUpSecsBeforeRecording? again in line 2157.
6060_2.diff is against mythwelcome:
- If we want to shut down and the wakeup time (or time for the next recording in mythshutdown terms - slightly confusing) is less than 100s in the past, assume that we should be awake and abort the shutdown.
These patches need some review because I'm not sure if I got the big picture. It'd also be good if the OP could try those. The second patch is not really necessary, I just added it to avoid a race condition where Mythbackend decides it's okay to call mythshutdown and for whatever reason that call takes enough for mythshutdown to decide that the startup time is in the past.
comment:3 Changed 15 years ago by
Type: | defect → patch |
---|---|
Version: | 0.21-fixes → head |
Ignore 6066_1.diff - it's broken. We want to use idleWaitForRecordingTime. Please use 6060_1-1.diff.
Changed 15 years ago by
Attachment: | 6060_1-1.diff added |
---|
comment:4 Changed 14 years ago by
Component: | mythshutdown → MythTV - Mythwelcome & Mythshutdown |
---|
comment:5 follow-up: 9 Changed 14 years ago by
A small change in welcomedialog.cpp should take care of this:
void WelcomeDialog::updateStatusMessage(void) {
m_statusList.clear();
QDateTime curtime = QDateTime::currentDateTime();
if (!m_isRecording && !m_nextRecordingStart.isNull() &&
curtime.secsTo(m_nextRecordingStart) - m_preRollSeconds - m_secondsToShutdown < m_idleWaitForRecordingTime * 60)
{
m_statusList.append(tr("MythTV is about to start recording."));
}
comment:6 Changed 14 years ago by
Status: | new → infoneeded_new |
---|
ralfd, mind attaching as a unified diff so we can get the reporter to test it?
comment:7 Changed 14 years ago by
Status: | infoneeded_new → new |
---|
comment:8 Changed 14 years ago by
Status: | new → infoneeded_new |
---|
Resetting clock on infoneeded-- bullestock, can you please apply ralfd's patch and let us know if it fixes your issue?
comment:9 Changed 14 years ago by
Ok, I guess I was a little too optimistic. There a a few different code sections that control this behaviour, not only the one I changed so far.
I was able to reproduce the behaviour that was reported by bullestock. The problem is that the code does not consider the time we give the backend prior to shutting down (m_secondsToShutdown). Most people probably have this value set pretty low (60 or 120s). Therefore it is rather unlikely that it becomes a problem. One would have to exit the frontend exactly within that timeframe prior to the next system start-up in order to have problems with it. The higher m_secondsToShutdown is the higher the probability that it becomes an issue.
I will dig into the code a little more when time allows and hope to be able to present a clean fix for this issue soon.
Don't bother applying the patch I uploaded.
Replying to ralfd:
A small change in welcomedialog.cpp should take care of this:
void WelcomeDialog::updateStatusMessage(void) {
m_statusList.clear();
QDateTime curtime = QDateTime::currentDateTime();
if (!m_isRecording && !m_nextRecordingStart.isNull() &&
curtime.secsTo(m_nextRecordingStart) - m_preRollSeconds - m_secondsToShutdown < m_idleWaitForRecordingTime * 60)
{
m_statusList.append(tr("MythTV is about to start recording."));
}
comment:11 Changed 14 years ago by
Status: | infoneeded_new → new |
---|
comment:12 Changed 14 years ago by
comment:13 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Backend log