Thread: Deadlocked App

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    2

    Deadlocked App

    Hello All -

    We have a legacy C program running non stop on one of our servers, with several instances often running at once. Fairly regularly, one of the instances while stop outputting to the log file and will just deadlock/hang. They must be then 'kill'ed by myself.

    When I gdb into one of the hung running processes, and enter the 'where' command I invariably get something like the following:

    (gdb) where
    #0 0x009f0402 in ?? ()
    #1 0x00bdf1ce in __lll_mutex_lock_wait () from /lib/libc.so.6
    #2 0x00b86abf in _L_mutex_lock_1965 () from /lib/libc.so.6
    #3 0x00000000 in ?? ()

    Does anyone recognise this? I'm sure it's indicative of a bug in the app but amn't sure how to track it down. Any suggestions would be very welcome.

    Mark.

  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
    Either
    - a process exited without releasing the lock
    - a process has the lock, and is stuck waiting for something else.

    You could create a debug wrapper of the mutex to see who currently has the lock when everything else is stuck waiting for 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.

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    2

    Thanks

    Thanks for the reply Salem.

    The app doesn't use mutex's deliberately. By that I mean there is no code specificly written to use mutex's, but I suppose they could be implemented by some external function.

    Could you suggest how to create a debug wrap as you suggested without knowing where exactly the problem is coming from?

    If I could debug one of the frozen apps with gdb, it could help trace back where the problem occurs at least. Can anyone advise on how best to do that?

    Mark.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. best program to start
    By gooddevil in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-28-2004, 05:56 PM
  3. Need help migrating console app to windows app
    By DelphiGuy in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2004, 07:05 PM
  4. pasword app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-07-2003, 10:28 AM
  5. How do I make my Linux app standalone?
    By Joda in forum C++ Programming
    Replies: 2
    Last Post: 11-27-2002, 04:53 AM