Thread: pthreads - hanging process - gdb output

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    pthreads - hanging process - gdb output

    Got a hanging process (with code posted in http://cboard.cprogramming.com/showthread.php?t=51261).

    attached to process pid and got the following backtrace:

    Code:
    (gdb) bt
    #0  0x40188a35 in pthread_getconcurrency () from /lib/i686/libpthread.so.0
    #1  0x40187db8 in pthread_create () from /lib/i686/libpthread.so.0
    #2  0x4018a210 in sem_unlink () from /lib/i686/libpthread.so.0
    #3  0x40186d77 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
    #4  0x420993d5 in adjtime () from /lib/i686/libc.so.6
    #5  0x4209829e in localtime_r () from /lib/i686/libc.so.6
    #6  0x420dfa86 in vsyslog () from /lib/i686/libc.so.6
    #7  0x420df9af in syslog () from /lib/i686/libc.so.6
    #8  0x08066312 in ouch ()
    #9  0x4018b7ce in __pthread_clock_settime () from /lib/i686/libpthread.so.0
    #10 0x42028518 in killpg () from /lib/i686/libc.so.6
    #11 0x080660bc in main ()
    #12 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
    (gdb)
    the ouch function is my signal handling function for INT, TERM and HUP signals.

    Does anyone think this is a problem because I'm not limiting the number of threads? It's getting a lot of connections .

    Could this be caused by PTHREAD_THREADS_MAX being reached ?

    Does PTHREAD_THREADS_MAX apply if I'm detaching the threads with pthread_detach ?

    Any suggestions to control short term until I get a thread pool up and running ?

    Hang on - I just noticed it's in the syslog functions . Is syslog thread-safe I'm calling it in the signal handling function and in the main thread at the same time.

    Cheers,

    Chris

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    In your singal handler, do as little as possible. Maybe set a global var only, and let the core app (or thread) take care of what to do. As for thread safe, your might have syslog_r()
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can any body unfold this sentences related to GDB.
    By vlrk in forum Linux Programming
    Replies: 2
    Last Post: 11-12-2008, 05:42 AM
  2. Need help fixing bugs in data parsing program
    By daluu in forum C Programming
    Replies: 8
    Last Post: 03-27-2003, 06:02 PM
  3. Control different DA output value!
    By Hunterhunter in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-13-2003, 12:11 PM
  4. how to get output of a process?
    By dkt in forum C Programming
    Replies: 5
    Last Post: 01-10-2003, 12:20 PM
  5. how to get the output of a non-stop process?
    By dkt in forum C Programming
    Replies: 1
    Last Post: 04-27-2002, 11:18 AM