I have an application that will repeatedly hang in the thread scheduler. They
seem to occur at somewhat random times, but it's always at the same place. The
hang occurs during the following code:

    if ((fp = popen(command, "r")) == NULL)
        return 0;
    if (fgets(str, sizeof(str), fp) == NULL) {
        return 0;
        return atoi(str);

Using printf()'s, I've found it occurs during the fgets(). Note though, this
code fragement is run successfully every ~20 seconds, but it's usually after
about an hour of runtime that it triggers a lockup. Attaching with gdb gives the
attached backtrace. Each time it hangs, it's stuck in poll() with a timeout of
INFTIM, with only one fd set to the _kernel_kern_pipe[0]. This is a SMP current

Is this a problem with the thread scheduler or is this somehow related to the

(gdb) bt
#0  0x284d74cc in poll () from /usr/lib/libc.so.5
#1  0x2848ce74 in thread_kern_poll (wait_reqd=1)
    at /usr/src/lib/libc_r/uthread/uthread_kern.c:833
#2  0x2848c7c9 in _thread_kern_scheduler ()
    at /usr/src/lib/libc_r/uthread/uthread_kern.c:481
#3  0xd0d0d0d0 in ?? ()
#4  0x282a66cc in g_main_run (loop=0x8167b40) at gmain.c:935
#5  0x281c6047 in gtk_main () from /usr/X11R6/lib/libgtk12.so.2
#6  0x80590f1 in main (argc=1, argv=0xbfbffb9c) at aim.c:610
#7  0x80576f9 in _start (arguments=0xbfbffc80 "gaim")
    at /usr/src/lib/csu/i386-elf/crt1.c:96

(gdb) frame 1
#1  0x2848ce74 in thread_kern_poll (wait_reqd=1)
    at /usr/src/lib/libc_r/uthread/uthread_kern.c:833
833             count = __sys_poll(_thread_pfd_table, nfds, timeout_ms);
(gdb) print *_thread_pfd_table
$1 = {fd = 3, events = 64, revents = 0}
(gdb) print nfds
$2 = 1
(gdb) print timeout_ms
$3 = -1

Thanks for any advice,


  Mike Heffner       <[EMAIL PROTECTED]>
  Blacksburg, VA           ICQ# 882073

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to