[mythtv-users] mythbackend crashing - solved

Maarten mythtv at ultratux.org
Tue Jul 6 07:27:38 EDT 2004


On Tuesday 06 July 2004 02:21, Alexander Varakin wrote:
> Hi,
>
> I had backend crashing once a day.
> The culprit was ntpd : it was adjusting time about 10 minutes after the
> PC was up, causing backend to crash.

That line tells you how to immediately solve it, too.  Do an initial ntpdate 
sync at boottime before starting ntpd.  Then ntp will just keep in sync.
I run ntp on my backend (with mpeg4 encoder) but have not had any crashes yet 
(well, after a month or so running maybe)

My distribution -SuSE- does this initial syncing out of the box, other 
distributions should too IMHO; adjusting time on a running machine is never a 
good idea anyway.  Gaps in logs, problems with running make, etc...

> It seems like this problem is specific to MPEG4 encoder.
> I think it is a good idea to put some code which handles this problem
> gracefully, something like this patch:

Very nice of you to patch it but I'd suggest patching /etc/init.d/ntp instead 
by adding a single 'ntpdate <server>' statement before the daemon starts. 
This way, a bad cmos time is also rectified, which ntpd typically will not.  

Maarten

> ===================================================================
> RCS file: /var/lib/mythcvs/mythtv/libs/libavcodec/h263.c,v
> retrieving revision 1.50
> diff -c -r1.50 h263.c
> *** h263.c      21 May 2004 05:30:54 -0000      1.50
> --- h263.c      6 Jul 2004 00:07:20 -0000
> ***************
> *** 2323,2328 ****
> --- 2323,2335 ----
>       time_mod= s->time%s->time_increment_resolution;
>       time_incr= time_div - s->last_time_base;
>       assert(time_incr >= 0);
> +
> +     if(time_incr < 0)
> +     {
> +         av_log(NULL, AV_LOG_ERROR, "System time was changed by some
> process.\nAre you running NTP daemon?\nIf yes, please disable it");
> +         time_incr = 0;
> +     }
> +
>       while(time_incr--)
>           put_bits(&s->pb, 1, 1);
> ===================================================================
>
> I tested this patch and it fixes the problem: it prints  a message and
> prevents backend from crashing.
>
> BTW, why assert on line 2325 of h263.c was not asserted even in debug
> build? Is NDEBUG defined somewhere or Myth has it's own assert?
>
> Regards,
> Alex
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

-- 
Linux: Because rebooting is for adding hardware.



More information about the mythtv-users mailing list