[mythtv-users] MythTV deciding to stop recording with Program "not found in PAT" error

Brett Randall brett.randall at gmail.com
Tue Nov 27 10:51:14 UTC 2012

On Sun, Nov 25, 2012 at 8:14 PM, John Pilkington <J.Pilk at tesco.net> wrote:

> On 25/11/12 06:56, Brett Randall wrote:
>> On Sun, Nov 25, 2012 at 5:48 PM, Nick Rout <nick.rout at gmail.com
>> <mailto:nick.rout at gmail.com>> wrote:
>>     On Sun, Nov 25, 2012 at 6:50 PM, Brett Randall
>>     <brett.randall at gmail.com <mailto:brett.randall at gmail.**com<brett.randall at gmail.com>>>
>> wrote:
>>         On Fri, Nov 23, 2012 at 11:42 PM, John Pilkington
>>         <J.Pilk at tesco.net <mailto:J.Pilk at tesco.net>> wrote:
>>             On 23/11/12 12:02, Mike Perkins wrote:
>>                 On 23/11/12 10:37, Brett Randall wrote:
>>                     Hi all
>>                     I've been running MythTV (under Mythbuntu 12.04.1
>>                     LTS) as my media centre
>>                     for the last year and, other than the occasional
>>                     hiccup, it's been great
>>                     and my family has loved it. I originally installed
>>                     0.24 but a few months
>>                     ago upgraded to 0.25. It remained stable after doing
>> so.
>>                     However, this last couple of weeks, it has lost the
>>                     plot. In typical Myth
>>                     fashion, the more I try to fix it with software
>>                     updates, firmware
>>                     changes,
>>                     etc, the worse it gets. The version I'm currently
>>                     running (from a Ubuntu
>>                     package) is 0.25.0+fixes.20120410.1f5962a-**
>> __0ubuntu1.
>>                     The last few days, as soon as a particular program
>>                     comes on ("Finley the
>>                     Fire Engine" - NO it is not for me ;-) ), Myth
>>                     freaks out with a PAT
>>                     error
>>                     and no longer records anything until I restart the
>>                     backend process
>>                     (normally having to use "kill -9" to stop it). The
>>                     exact log entries are:
>>                       ...
>>                     Nov 23 06:25:48 myth mythbackend[11231]: E DVBRead
>>                     dtvsignalmonitor.cpp:321
>>                     (HandlePAT) DTVSM(/dev/dvb/adapter0/__**frontend0):
>>                     Program #2370 not
>>                     found in
>>                     PAT!#012Program Association Section#012 PSIP
>>                     tableID(0x0) length(41)
>>                     extension(0x221)#012      version(16) current(1)
>>                     section(0)
>>                     last_section(0)#012      tsid(545)
>>                     programCount(8)#012  program number
>>                     0 has PID 0x0010#012  program number   544 has PID
>>                     0x0102#012  program
>>                     number   545 has PID 0x0100#012  program number
>>                     546 has PID 0x0101#012
>>                     program number   547 has PID 0x0103#012  program
>>                     number   548 has PID
>>                     0x0106#012  program number   550 has PID 0x0104#012
>>                       program number   551
>>                     has PID 0x0105
>>                       ...
>>                     Definitely value any advice in getting around this!
>>                 This generally means that since you last scanned, the
>>                 contents of the
>>                 transport stream have changed. Either a channel which
>>                 was thought to
>>                 exist no longer does[1] or something extra has now
>> appeared.
>>                 Since the internal table of channels within the
>>                 multiplex which mythtv
>>                 builds now no longer corresponds to what it is
>>                 receiving, it is telling
>>                 you so. Of course, this also means that there may be
>>                 errors trying to
>>                 extract a stream from the multiplex, which is what you
>>                 are observing.
>>                 The standard answer is to rescan, which may solve your
>>                 problem. I'm not
>>                 sure where in the world you are so it may mean you need
>>                 to take other
>>                 action, such as updating your SD lineup or editing your
>>                 channel data in
>>                 mythtv-setup.
>>                 [1] It /is/ possible to have part-time channels; mythtv
>>                 does the right
>>                 thing in this case.
>>             That would be my suggestion too, but he says he's in
>>             Australia and did all the standard delete-and-rescan things
>>             and still has the problem. Maybe the EIT hasn't caught up
>>             yet; maybe the multiplex tables aren't fully populated.  And
>>             don't people in Oz usually use Shephard(?) data? But I doubt
>>             that that is the problem - it sounds like reception rather
>>             than scheduling difficulties.
>>             Did the scans find duplicate channels?  Perhaps you have
>>             more transports defined than you really need.
>>         Thanks for your thoughts. Reception isn't the problem - I get
>>         75% signal strength on that channel and can watch it just fine
>>         live, without drops. The entire program guide is there, too,
>>         even though it took about an hour to populate after I cleared
>>         the video sources, transports, etc out.
>>         I've managed to fix it, in a manner of speaking, for now. I
>>         deleted the Recording Rule for "Finley the Fire Engine" (the
>>         program which the backend would freeze on each morning with the
>>         PAT error) and the next day, the remainder of recordings worked.
>>         Today, the recordings also worked without a restart.
>>     Is Finley the only programme you record from that channel? Could it
>>     be a tuning problem needing a rescan of that transport? (Live TV can
>>     be set to use a different tuning method, I think they are called
>>     slow and fast and I can't recall where to set  it or what it does,
>>     but it can result in a channel recording correctly but not working
>>     in Live TV, and presumably vice versa.)
>> No, I record about 15 shows from that channel, the rest are recording
>> fine. But looking back, every time Myth would freeze, it would be on
>> that one show.
>> Brett.
> Is this a part-time channel?  I haven't seen a freeze such as you report,
> but scheduling the first recording after startup will give me an apparently
> blank recording which plays fine after a run through mythcutprojectx with
> no cutlist.  Similar funnies on recording over closedown.  You could check
> by delaying recording start,
> In the UK this affects eg Cbeebies/BBC FOUR at 7 pm.
> John

Not part-time that I know of? I just noticed that it stopped recording
again with the same error at 2pm yesterday (normally 7am). Again, recording
from the same channel, same error, but different time.

I've written a Perl script (code below, in case anyone else ever wants it)
which I've set in cron to run every minute. This will solve my problems for
now :)



#!/usr/bin/perl -w

use strict;

# Temporary file for storing the last time a PAT error occurred
my $tmp_file = "/tmp/last_pat_check_time";

# Log file we're scanning
my $log_file = "/var/log/mythtv/mythbackend.log";

# Code
my ($last_time,$need_to_restart,$cur_time);
if (-f $tmp_file) {
    open (IN,$tmp_file);
    $last_time = <IN>;
    close IN;

open (IN,$log_file);
while (<IN>) {
    ($cur_time) = (/^(\w+\s+\d+\s+\d+\:\d+\:\d+)/);
    if (/not found in PAT/) {
        $need_to_restart = 1;
    if ($last_time) {
        $need_to_restart = 0 if $cur_time eq $last_time;
close IN;

if ($need_to_restart) {
    system "/etc/init.d/mythtv-backend stop";
    system "/usr/bin/killall -9 mythbackend";
    system "/etc/init.d/mythtv-backend start";
    open (OUT,">$tmp_file");
    print OUT $cur_time;
    close OUT;

exit 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20121127/e7c0559c/attachment.html>

More information about the mythtv-users mailing list