[mythtv-users] mythbackend crashing - solved

Alexander Varakin avarakin at optonline.net
Mon Jul 5 20:21:15 EDT 2004


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.
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:

===================================================================
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



More information about the mythtv-users mailing list