Date: Thu, 01 Feb 2001 14:08:54 -0500 (EST) From: Mike Heffner <mheffner@vt.edu> To: FreeBSD-current <FreeBSD-current@freebsd.org> Subject: program hangs in thread scheduler Message-ID: <XFMail.20010201140854.mheffner@vt.edu>
next in thread | raw e-mail | index | archive | help
Hi, 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) { pclose(fp); return 0; } pclose(fp); 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 box. Is this a problem with the thread scheduler or is this somehow related to the application? (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 <mheffner@vt.edu> Blacksburg, VA ICQ# 882073 http://filebox.vt.edu/users/mheffner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20010201140854.mheffner>