libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] UNW_CACHE_PER_THREAD


From: Arun Sharma
Subject: Re: [Libunwind-devel] UNW_CACHE_PER_THREAD
Date: Tue, 8 Jan 2013 15:27:17 -0800

On Tue, Jan 8, 2013 at 2:33 PM, Prabhat Verma <address@hidden> wrote:
malloc 
  observe_malloc      - our malloc hook 
    unwind_stack      - Linux libunwind implementation 
      unw_step (takes libunwind CACHE lock) 
        dl_interate_hdr (takes dl lock) 

The same deadlock may happen while THREAD 1 is in dlsym and other dl functions that all internally use the same recursive lock dl lock and allocate memory.

This is a well known issue. dl_iterate_phdr in glibc is not async signal safe. So it's not safe to call from libunwind. One solution is to patch your glibc to make it async signal safe (trade-off: allocate all the needed memory upfront or using async signal safe APIs and use atomics where possible). It's not trivial, but not impossible either.

Other solutions can mask this problem, but on a large enough dataset, this issue will manifest in other ways.

 -Arun

reply via email to

[Prev in Thread] Current Thread [Next in Thread]