Threads consuming memory - GDB debugging to narrow down the issue
by vlrk from LinuxQuestions.org on (#5JNF7)
Hi ,
I have one daemon which spawns around 15 threads.
first five threads timedwait threads.
third thread is service thread
other five threads are notified threads.
There are couple of issues , i am facing below.
1. Incrementally i am seeing that process is taking huge memory . I am seeing this process consumption from top command. Where this daemon process is eating 15% of memory when it stops responding.
2. From gdb trace i see the control flow got locked at below stack trace.
Thread 25 (Thread 0x7ff2dabef700 (LWP 11050)):^M
#0 0x00007ff2dd607b6c in __lll_lock_wait_private () from /lib64/libc.so.6^M
#1 0x00007ff2dd586bd6 in _L_lock_12192 () from /lib64/libc.so.6^M
#2 0x00007ff2dd584181 in malloc () from /lib64/libc.so.6^M
#3 0x00007ff2dd58a52a in strdup () from /lib64/libc.so.6
3. I see like around 10 threads waiting on same mutex varaiable as showed below in gdb trace.
#1 0x00007ff2de324d32 in _L_lock_791 () from /lib64/libpthread.so.0^M
#2 0x00007ff2de324c38 in pthread_mutex_lock () from /lib64/libpthread.so.0^
I want to debug this issue with gdb . Mainly i want to find which thread is eating memory.
Any steps to check or related articles would be very usefull.
Thanks
vlrk
I have one daemon which spawns around 15 threads.
first five threads timedwait threads.
third thread is service thread
other five threads are notified threads.
There are couple of issues , i am facing below.
1. Incrementally i am seeing that process is taking huge memory . I am seeing this process consumption from top command. Where this daemon process is eating 15% of memory when it stops responding.
2. From gdb trace i see the control flow got locked at below stack trace.
Thread 25 (Thread 0x7ff2dabef700 (LWP 11050)):^M
#0 0x00007ff2dd607b6c in __lll_lock_wait_private () from /lib64/libc.so.6^M
#1 0x00007ff2dd586bd6 in _L_lock_12192 () from /lib64/libc.so.6^M
#2 0x00007ff2dd584181 in malloc () from /lib64/libc.so.6^M
#3 0x00007ff2dd58a52a in strdup () from /lib64/libc.so.6
3. I see like around 10 threads waiting on same mutex varaiable as showed below in gdb trace.
#1 0x00007ff2de324d32 in _L_lock_791 () from /lib64/libpthread.so.0^M
#2 0x00007ff2de324c38 in pthread_mutex_lock () from /lib64/libpthread.so.0^
I want to debug this issue with gdb . Mainly i want to find which thread is eating memory.
Any steps to check or related articles would be very usefull.
Thanks
vlrk