Thread: Hangs with pthread_getconcurrency

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

    Hangs with pthread_getconcurrency

    Hi All - seems pretty quiet in here now-a-days

    I've got a problem with various processes hanging on pthread_getconcurrency. I've managed to attach to an example and do a backtrace:

    0x40187a35 in pthread_getconcurrency () from /lib/i686/libpthread.so.0
    (gdb) bt
    #0 0x40187a35 in pthread_getconcurrency () from /lib/i686/libpthread.so.0
    #1 0x40186db8 in pthread_create () from /lib/i686/libpthread.so.0
    #2 0x40188e68 in sem_unlink () from /lib/i686/libpthread.so.0
    #3 0x40185d96 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
    #4 0x401884b4 in flockfile () from /lib/i686/libpthread.so.0
    #5 0x42064c4a in puts () from /lib/i686/libc.so.6
    #6 0x4018a7ce in __pthread_clock_settime () from /lib/i686/libpthread.so.0
    #7 0x42028518 in killpg () from /lib/i686/libc.so.6
    #8 0x40186db8 in pthread_create () from /lib/i686/libpthread.so.0
    #9 0x40188e68 in sem_unlink () from /lib/i686/libpthread.so.0
    #10 0x40185d96 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
    #11 0x401884b4 in flockfile () from /lib/i686/libpthread.so.0
    #12 0x4204c001 in vfprintf () from /lib/i686/libc.so.6
    #13 0x42052592 in printf () from /lib/i686/libc.so.6
    #14 0x080698b8 in StartSocketServer(void*, int) ()
    #15 0x08069b24 in main ()
    #16 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
    (gdb)


    Umm - maybe I'm reading the backtrace wrong but why is printf sparking such a series of methods calls through the creation of a pthread to pthread_getconcurrency???

    I'm thinking this is an OS issue as it's happened more than once with different processes - google isn't much help.

    I'm using redhat 8.0 (I know!!) and a 2.4 kernel

    Anyone seen this before

    Cheers,, rotis23

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    In the absense of your code, I'm going to say there is a problem with your code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    OK - I appreciate that. This is more of a general question on debugging I guess.

    I'm really interested in what printf is doing in this stack trace.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Yes, it's an OS issue.

    Sorry, but I've no idea what your question is. It seems to me to be, "hey, look at this stack trace, isn't it freaky?"

    To which the answer is, "yes, I've read it".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    heh - OK (you're holding back on me) - Let's state some questions:

    - Is printf really calling all those nested functions underneath?

    - Is pthread_getconcurrency a known rogue?

    - Is gdb/strace returning pthread_getconcurrency because I'm attaching to the parent process? i.e. is the real problem in a child thread that I cannot attach to?

    - Should I stop using stable, reliable yet completely out-of-date and unpatchable redhat 8.0?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program hangs when encounters switch
    By maverix in forum C Programming
    Replies: 6
    Last Post: 12-21-2007, 04:17 AM
  2. Replies: 8
    Last Post: 04-12-2007, 12:42 PM
  3. program hangs during runtime
    By nizbit in forum C Programming
    Replies: 8
    Last Post: 02-19-2005, 10:50 AM
  4. Simple copy program hangs?
    By curlious in forum Linux Programming
    Replies: 3
    Last Post: 07-24-2004, 05:00 PM
  5. my C++ program hangs during memory deallocation.
    By the-tzar in forum C++ Programming
    Replies: 6
    Last Post: 03-06-2004, 10:39 AM