qchbai / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Our application process is hanged with deadlock. Our application uses libtcmalloc.so with LD_PRELOAD environment variable which internally uses libunwind.so #433

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. tcmalloc compile(./configure; make)
2. LD_PRELOAD=./libtcmalloc.so ./a.out
3. pstack [pid]

see attached stack

What is the expected output? What do you see instead?

No dead-lock.

What version of the product are you using? On what operating system?

Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Linux 2.6.18-194.el5 #1 SMP x86_64 x86_64 x86_64 GNU/Linux

Please provide any additional information below.

I suspect LWP 31760 is causing deadlock with GetStackTrace and then 
dl_iterate_phdr.

Original issue reported on code.google.com by dvhv.sek...@gmail.com on 24 May 2012 at 10:25

Attachments:

GoogleCodeExporter commented 9 years ago
Do you have any further update here? From looking through the core file I am 
not convinced that there is a lock order reversal between tcmalloc and pthread.

Original comment by chapp...@gmail.com on 23 Dec 2012 at 2:36

GoogleCodeExporter commented 9 years ago
I think i'm having the same problem but it does not happen all the time. It's 
hard to debug.

One thing though, it appears to only happen when doing a HEAPCHECK ... dunno if 
it helps.

Original comment by xAdE...@gmail.com on 22 Feb 2013 at 3:04

GoogleCodeExporter commented 9 years ago
This is deadlock between libdl lock taken in dlopen and being waited for by 
dl_iterate_phdr and tcmalloc spinlock.

Later versions of glibc fixed this by having separate lock that dl_iterate_phdr 
take and that dlopen takes but very briefly.

My investigation of RHEL5 glibc shows that latest rhel5 releases _do have_ that 
fix.

Setting to "cannot-reproduce" to indicate that issue is fixed but not by us.

Please reopen if RHEL 4.9 still causes same deadlock.

Original comment by alkondratenko on 6 Jul 2013 at 11:53