[vdr] VDR gets somehow stuck and consumes all CPU time

Gerald Raaf Gerald.Raaf at T-Online.de
Sun Dec 4 11:26:11 CET 2005


Am Sonntag, 4. Dezember 2005 10:37 schrieb Klaus Schmidinger:
> Johannes Stezenbach wrote:
> > On Sat, Dec 03, 2005, Klaus Schmidinger wrote:
> >>(AFAIK with NPTL all threads
> >>of a given program have the same pid, so you won't be able to
> >>distinguish them in 'top').
> >
> > This is not entirely true, you can still see and distinguish
> > the threads in htop or "ps -T u -C vdr" etc. (top does not work).
> >
> > The patch below might help, gettid() returns the PID of the thread. (And
> > since it's a syscall it is independent of NPTL vs. linuxthreads. Tested
> > on 2.6 only, but the gettid man page says it's available in 2.4.20.
> > gettid() is Linux specific.)
>
> Does this "gettid" call return a different tid than "pthread_self()"?
>

pthread_self() sample output log
[2005/12/04 11:14:02] vdr vdr[27644]: tuner on device 3 thread started 
(pid=27644, tid=-1265644624)
sample output ps -T u -C vdr
root at vdr:~# ps -T u -C vdr
USER       PID  SPID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     27644 27644  3.2  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27742  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27743  0.0  2.5 129332 26624 ?        RNl  11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27745  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27746  0.0  2.5 129332 26624 ?        SNl  11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27748  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27749  0.0  2.5 129332 26624 ?        SNl  11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27750  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27751  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27752  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     27644 27753  0.0  2.5 129332 26624 ?        Sl   11:14   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -


gettid()  sample output log with Patch from Johannes Stetzenbach
[2005/12/04 11:16:15] vdr vdr[29989]: tuner on device 3 thread started 
(pid=29989, tid=30086)
sample output ps -T u -C vdr
root at vdr:~# ps -T u -C vdr
USER       PID  SPID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     29989 29989  0.1  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30080  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30081  0.0  2.5 129380 26640 ?        SNl  11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30083  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30084  0.0  2.5 129380 26640 ?        SNl  11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30086  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30087  0.0  2.5 129380 26640 ?        SNl  11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30088  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30089  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30090  0.0  2.5 129380 26640 ?        Sl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -
root     29989 30091  0.0  2.5 129380 26640 ?        Rl   11:16   0:00 ./vdr 
-w 60 -s /usr/local/bin/stopvdr -r /usr/local/bin/record.sh -

my System is a NPTL only System (Linuxfromscatch System) with vdr-1.3.37.

> I'm just wondering because the introduction of "pthread_self()" was one
> of the things we had to change to make VDR run with NPTL...
>
> Klaus
>
> > Johannes
> >
> > --- vdr-1.3.37/thread.c.orig	2005-12-03 19:52:38.000000000 +0100
> > +++ vdr-1.3.37/thread.c	2005-12-03 20:12:47.000000000 +0100
> > @@ -17,6 +17,11 @@
> >  #include <unistd.h>
> >  #include "tools.h"
> >
> > +static inline pid_t gettid(void)
> > +{
> > +  return (pid_t) syscall(224);
> > +}
> > +
> >  static bool GetAbsTime(struct timespec *Abstime, int
> > MillisecondsFromNow) {
> >    struct timeval now;
> > @@ -231,10 +236,10 @@ void cThread::SetDescription(const char
> >  void *cThread::StartThread(cThread *Thread)
> >  {
> >    if (Thread->description)
> > -     dsyslog("%s thread started (pid=%d, tid=%ld)", Thread->description,
> > getpid(), pthread_self()); +     dsyslog("%s thread started (pid=%d,
> > tid=%d)", Thread->description, getpid(), gettid()); Thread->Action();
> >    if (Thread->description)
> > -     dsyslog("%s thread ended (pid=%d, tid=%ld)", Thread->description,
> > getpid(), pthread_self()); +     dsyslog("%s thread ended (pid=%d,
> > tid=%d)", Thread->description, getpid(), gettid()); Thread->running =
> > false;
> >    Thread->active = false;
> >    return NULL;
>
> _______________________________________________
> vdr mailing list
> vdr at linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



More information about the vdr mailing list