Opened 11 years ago

Closed 6 years ago

#12290 closed Bug Report - General (Fixed)

Commercial Flagging isn't being queued.

Reported by: Bill Meek <keemllib@…> Owned by: Roger Siddons
Priority: minor Milestone: 30.1
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In: TVRecEvent programinfo.cpp (GetFilesize) the existing returned filesize is sometimes 0 and TVRec::FinishedRecording won't allow the job to be queued if the file size is less than 1000 bytes.

This has deactivated all commercial flagging. A workaround is attached (not a fix.)

Attachments (8)

commercial-flagging-not-queued-workaround.patch0 (2.5 KB ) - added by Bill Meek <keemllib@…> 11 years ago.
Workaround - tested on: v0.28-pre-2261-g53254f3
mythbackend.20150420180329.30958.log (32.2 KB ) - added by Bill Meek <keemllib@…> 10 years ago.
1st try blocked
mythbackend.20150422001210.13197.log (210.9 KB ) - added by Bill Meek <keemllib@…> 10 years ago.
Additional LOG()s added.
12290.patch (1.2 KB ) - added by Bill Meek 10 years ago.
before.log (10.3 KB ) - added by Roger Siddons 9 years ago.
Zero filesize
after.log (9.6 KB ) - added by Roger Siddons 9 years ago.
Correct filesize
12290-Bills-instrumentation.patch (2.8 KB ) - added by Roger Siddons 9 years ago.
Logging
12290-Report-correct-filesize-at-recording-end.patch (2.0 KB ) - added by Roger Siddons 9 years ago.
Fix

Download all attachments as: .zip

Change History (43)

by Bill Meek <keemllib@…>, 11 years ago

Workaround - tested on: v0.28-pre-2261-g53254f3

comment:1 by km@…, 11 years ago

Thanks to Bill Meek for the workaround. I've had to use it to patch programinfo.cpp every time that file gets updated on the trunk for the last 5 months. Isn't it about time to integrate it?

comment:2 by stuartm, 10 years ago

I believe this was fixed months ago.

comment:3 by stuartm, 10 years ago

Resolution: Fixed
Status: newclosed

If this continues to be a problem for anyone then we need more information. The file size is not even stored in ProgramInfo any more, they are saved to and read from RecordingFile and the corresponding RecordedFile table.

comment:4 by Stuart Morgan <smorgan@…>, 10 years ago

In 767370fe7ea41f78ae99b7cd1ef4ddcdf5d8d016/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:5 by Bill Meek <keemllib@…>, 10 years ago

Resolution: Fixed
Status: closednew

Sorry, that doesn't solve the issue.

I added some LOG()s to demonstrate.

tv_rec.cpp:936 (FinishedRecording) - fsize>=1000 allows previewgen. fsize=0.
...
tv_rec.cpp:989 (FinishedRecording) - fsize<1000 disables commflag/xcode. fsize=0.

Full log and LOG() patch attached.

by Bill Meek <keemllib@…>, 10 years ago

1st try blocked

comment:6 by Bill Meek <keemllib@…>, 10 years ago

To answer the questions on the mythtv channel, it's not the 0 byte file case. The recording plays back OK, manual commercial flagging works OK

mysql> SELECT recordedid FROM recorded WHERE title='Love It or List It';
| recordedid |
|       2916 |

mysql> SELECT r.filesize,rf.filesize FROM recorded AS r,
    recordedfile AS rf WHERE r.recordedid=2916 and rf.recordedid=2916;
| filesize  | filesize  |
| 883567100 | 883567100 |

comment:7 by stuartm, 10 years ago

Thanks for the follow up Bill. So it seems the cached RecordingInfo used in TVRec isn't being updated ...

comment:8 by Stuart Morgan <smorgan@…>, 10 years ago

In cf4da125a78bde32fb309fbddfc557993d4045fe/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:9 by Stuart Morgan <smorgan@…>, 10 years ago

In 31da15ad7b55cd203f0f9d86b68de4aae089b317/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:10 by Bill Meek <keemllib@…>, 10 years ago

I added 2 more LOG()s and they return:

TVRecEvent recordinginfo.cpp:1628 (GetFilesize) - #12290 GetRecordingFile()->m_fileSize = 0
TVRecEvent recordinginfo.cpp:1637 (GetFilesize) - #12290 ProgramInfo::GetFilesize() = 0

And more LOG()s in RecordingFile::RecordingFile and RecordingFile::Save:

This keeps incrementing during the recording:

recordingfile.cpp RecordingFile::Save() #12290, m_fileSize=405709264

Which then starts returning 0 (1268 times) after the recording finishes

Full log attached.

by Bill Meek <keemllib@…>, 10 years ago

Additional LOG()s added.

comment:11 by drew@…, 10 years ago

Can anything be done to further this along? This bug is quite annoying for those of us that don't build from source to manually patch.

If someone can point me where to start, I don't mind attempting a patch myself.

comment:12 by Stuart Auchterlonie, 10 years ago

Milestone: unknown0.28

by Bill Meek, 10 years ago

Attachment: 12290.patch added

comment:13 by Bill Meek, 10 years ago

POC patch, works fine, I just don't know how to treat the other 6 calls to FinishedRecording().

comment:14 by JYA, 10 years ago

Bill, anything more required ? that last patch seems good enough to me.

comment:15 by Bill Meek <keemllib@…>, 10 years ago

Unfortunately, it isn't enough. When RingBufferChanged() (https://code.mythtv.org/cgit/mythtv/tree/mythtv/libs/libmythtv/tv_rec.cpp#n3358) is used, I've not been able to recover a size. I haven't seen the other 4 calls to FinishedRecording() used. Had to go back to the workaround in comment 1.

comment:16 by km@…, 10 years ago

I can also report that the new patch is not a complete solution. Some recordings get flagged others don't. With the original patch all recordings that are set for auto flagging get flagged.

With neither patch, nothing gets auto flagged.

comment:17 by Bill Meek <bmeek@…>, 10 years ago

In 2e98fb583276c3966fed21fab354b11c7e5d591c/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:18 by Bill Meek <bmeek@…>, 10 years ago

In 4ffac871792a83aa354230a0655651c934c2bf40/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:19 by Stuart Auchterlonie, 9 years ago

Milestone: 0.280.29

Moving to 0.29

comment:20 by Stuart Auchterlonie, 9 years ago

Milestone: 0.2929.0

Milestone renamed

comment:21 by Roger Siddons, 9 years ago

The "Hack fix" (31da15ad7) wasn't implemented correctly.

There are 2 instances of m_recording_file (in 2 separate RecInfos): the TVRec one is created at start of the recording and never updated, the Recorder one contains the updated filesize (and other data).

That patch intends to reload the stale instance but it is ineffective because the TVRec instance already exists. It needs to be forcibly reloaded.

I reverted the 4 patches on this ticket (2e98fb5832, 31da15ad7, cf4da125a78, 767370fe7e) and applied Bill's instrumentation to reproduce the before.log. Then applied the new patch to produce the after.log.

by Roger Siddons, 9 years ago

Attachment: before.log added

Zero filesize

by Roger Siddons, 9 years ago

Attachment: after.log added

Correct filesize

by Roger Siddons, 9 years ago

Logging

by Roger Siddons, 9 years ago

Fix

comment:22 by stuartm, 9 years ago

Milestone: 29.00.28.1
Owner: set to stuartm
Status: newaccepted

comment:23 by Stuart Auchterlonie, 9 years ago

Milestone: 0.28.10.28.2

Moving remaining open 0.28.1 tickets to 0.28.2

comment:24 by Roger Siddons, 8 years ago

Status: acceptedinfoneeded

Can anyone confirm whether the solution in comment 21 fixes the issue ?

comment:25 by Roger Siddons, 8 years ago

Owner: changed from stuartm to Roger Siddons

in reply to:  24 comment:26 by Bill Meek, 8 years ago

Replying to rsiddons:

Can anyone confirm whether the solution in comment 21 fixes the issue ?

Roger,

Only two tests, and flagging is queued (and works.) That's with the four reverts plus your fix. I should track it for a few days as others have reported inconsistent results with previous patches.

Looks like an edge case when the backend is restarted mid recording. The 2nd recording is flagged, the 1st isn't. I don't recall ever testing this originally and haven't tried with the old solution yet. Likely a new issue.

comment:27 by Roger Siddons, 8 years ago

Thanks Bill,

Soak-test by all means but it would be nice if we could tidy this up for 28.2

The "old solution" was a work-around to the fact that a new implementation wasn't working properly.

I don't actually use the commflagger. I landed here because I had an issue with 0 filesizes elsewhere. Turns out it was unrelated...

However, isn't the job created by an end-of-recording event ? Should the backend check for interrupted recordings due for comm-flagging on startup ? User should start it manually IMO. And outside the scope of this ticket :)

comment:28 by Bill Meek, 8 years ago

Seems to be working great. Tested on v29-pre. Do you want to push the four reverts and fix or would you like me to?

Last edited 8 years ago by Bill Meek (previous) (diff)

comment:29 by Roger Siddons, 8 years ago

Milestone: 0.28.229.0
Status: infoneededassigned

On review, it appears to no longer be an issue on 28/fixes: the work-around seems to be effective.

Whilst the fixes in comment:21 fix the specific issue on this ticket, the underlying changes that provoked it remain incomplete so it's not robust enough to be back-ported.

Targeting it for 29/master, once I've assessed what is still broken & the way forward.

Leaving this open to track it. Please report any observations of wrong filesizes.

comment:30 by Stuart Auchterlonie, 8 years ago

Milestone: 29.029.1

comment:31 by Roger Siddons, 8 years ago

Milestone: 29.129.2

comment:32 by dizygotheca, 7 years ago

Milestone: 29.230.1

comment:33 by Mac Michaels, 6 years ago

Is 3 years long enough to track this issue?

comment:34 by Stuart Auchterlonie, 6 years ago

Status: assignedinfoneeded

Bill, is this still an issue, or can this be closed?

comment:35 by Bill Meek, 6 years ago

Resolution: Fixed
Status: infoneededclosed

It's working. But I just undid a single conversion from Stuart Morgan's ProgramInfo -> RecordedInfo work. I see Roger kept it open to track the root cause.

Closing. A new ticket can be used to track the underlying issue if someone wants to go after it.

Note: See TracTickets for help on using tickets.