<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 7, 2020, 1:47 PM DaveD, <<a href="mailto:mythtv@guiplot.com">mythtv@guiplot.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 6/6/20 5:13 PM, Martin Compton wrote:<br>
> On 6/6/20 6:35 PM, Peter Bennett wrote:<br>
>><br>
>> On 6/6/20 6:42 PM, Ian Evans wrote:<br>
>>> Not near my system right now but looked at the status page online <br>
>>> and noticed a long list of queued jobs. (System currently has two <br>
>>> cores and I limit the number of running jobs to 1)<br>
>>><br>
>>> The box was stuck on a mythmetalookup job for a show that aired last <br>
>>> night. Occasionally I will see it get stuck one a commflag job. <br>
>>> Maybe it happens a couple of times a month. I don't know if this is <br>
>>> a feature request or something that could be handled by the OS, but <br>
>>> is it possible to check and see if certain MythTV processes have <br>
>>> been running for a ridiculously long time and just terminate them?<br>
>>><br>
>> There may be a bug here - I suspect if it does not get a response to <br>
>> a request to a web site that it waits for a very long time. Probably <br>
>> some better checking in the metadata lookup job would help.<br>
><br>
> Getting stuck on metalookup happens a few times a month for me, using <br>
> Ubuntu 16.04 / MythTV 29.  It had been happening for years, but I <br>
> blamed it in part from being on a satellite Internet connection.  <br>
> However, I'm now on terrestrial Internet and still see the same <br>
> problem.  I've never seen anything in the logs to hint at the <br>
> problem.  Restarting mythtv-backend 'fixes' the job queue.<br>
<br>
The only problem I've had is mythcommflag running forever.  It happens a <br>
lot on Evening Magazine, a 1/2 hour show shown in Seattle at 7:30 PM, <br>
but not always.  It also happens on any recording with the least <br>
corruption (which may be a common problem with Evening Magazine).  Once <br>
it happens, the jobs just queue up behind it, so I wrote a perl script <br>
that cron runs at 2:00 AM and 10:00 AM.  By the time I look, there are <br>
no queued mythcommflag processes any more.<br>
<br>
Dave D.<br>
<br>
Here's the script:<br>
<br>
#!/usr/bin/perl -l<br>
<br>
use strict;<br>
<br>
my @comflags = `/usr/bin/ps xwa -o pid,etime,command | grep mythcommflag <br>
| grep -v grep`;<br>
chomp @comflags;<br>
#  The ps command, above, results in something like this for a normal <br>
process.  A hung process has an etime (2nd field) of something like <br>
7-18:42:20 (7 days, 18 hours!)<br>
# 1009821       04:04 /usr/bin/mythcommflag -j 12276 --noprogress <br>
--verbose general --logpath /var/log/mythtv --loglevel info<br>
<br>
foreach my $p (@comflags) {<br>
         $p =~ s/^\s+|\s+$//;  # strip leading/trailing white space<br>
         my ($pid, $etime, $rest) = split /\s+/, $p, 3;<br>
<br>
         my @time_parts = split /\D+/, $etime;<br>
<br>
         # More than a day?  Add the days to hours<br>
         if (scalar @time_parts > 3) {<br>
                 my $days = shift @time_parts;<br>
                 $time_parts[0] += 24 * $days;<br>
         }<br>
<br>
         # more than 3 hours?<br>
         if ($time_parts[0] > 2) {<br>
                 print "PID $pid has elapsed time of $etime <br>
($time_parts[0]+ hours) on \"$p\"\n";<br>
                 print "Killing process $pid\n";<br>
                 system "kill -9 $pid";<br>
<br>
                 # "next" (instead of "exit") would check them all. <br>
Hopefully the first one is the<br>
                 # culprit and this will free up the system to do the others<br>
                 exit;<br>
         }<br>
}<br>
<br><br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">As Chong once said to Cheech: "Oh cool beans, man."</div><div dir="auto"><br></div><div dir="auto">That script seems to be just what the doctor ordered. </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
</blockquote></div></div></div>