Platform: x86_64, RedHat 5, kernel 2.6.29
I have a situation in which a callstack sampler is unwinding the stack
while a thread is in the midst of processing an exception. This leads
to deadlocks because __cxa_throw_ is ultimately calling
dl_iterate_phdr() and so is the libunwind function
dwarf_find_proc_info().
This is a long standing problem in libunwind with no generic solution yet. Couple of possible approaches have been discussed before:
a) Implement your own async signal safe dl_iterate_phdr(). But this depends on a modified libc.
b) Call dl_iterate_phdr() in a separate thread and cache the result in a data structure that is safe to access from other threads without locks.
-Arun