Hi all,

I am working on a multi-thread application hang problem on Solaris. Stack trace 
shows that a thread is trying to grep a mutex by calling: 

-----------------  lwp# 12 / thread# 11  --------------------
 ff11f7f8 lwp_mutex_lock (fe7a73c8)
 ff26ae80 _mutex_lwp_lock (ff299218, ff28c000, ffffabcd, 561b94, fe7a73c8, 0) + 
4
....

Then it sits there and waits forever for mutex (fe7a73c8), the resources hold 
by this thread (lwp# 12) blocks other threads, and thus cause the entire 
application to hang. 

I am just wondering if there are any methods to print out the information about 
mutex (fe7a73c8) so that it tells what ** THREAD ** within the application is 
holding such mutex. Ideally, I can add those diagnostic codes into the 
application, it then collects those mutex information when the problem 
re-occurs, and allows me to further investigate the problem. 

According to /usr/include/sys/synch.h, the mutex structure is defined as: 

typedef struct _lwp_mutex {
        struct _mutex_flags {
                uint8_t         flag[4];
                uint16_t        type;
                uint16_t        magic;
        } flags;
        union _mutex_lock_un {
                struct _mutex_lock {
                        uint8_t pad[8];
                } lock64;
                upad64_t owner64;
        } lock;
        upad64_t data;
} lwp_mutex_t;

I don't know what field in the above structure that stores the thread id 
holding the mutex. 

Any suggestions/help are highly appreciated. 

Zhi Huang
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to