libunwind-devel
[Top][All Lists]
Advanced

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

[Libunwind-devel] [patch] Fix for fast unwind and tcmalloc not playing w


From: Paul Pluzhnikov
Subject: [Libunwind-devel] [patch] Fix for fast unwind and tcmalloc not playing well together.
Date: Wed, 19 Oct 2011 16:08:41 -0700

Greetings,

I am now trying to use Lassi's fast trace, and the results are exceptionally
good: on some of my test cases the overhead of using libunwind (compared
to frame-based unwinder) went from 9x to 1.2x ;-)

Lassi, thanks!

One problem that cropped up: tcmalloc wants to record stack traces on free,
and this causes a crash when a thread is exiting.

Glibc calls thread-specific dtors in the order in which the keys were added,
so the first dtor is the trace_cache_free() one. Then thread-specific
data for some other key is free()d, which calls into unw_backtrace(),
which uses dangling cache and munmapped cache->frames.

Attached patch
1. delays destruction of trace cache to the last possible moment, and
2. clears tls_cache, so the dangling pointer will not be used.

Tested on Linux/x86_64 (Ubuntu 10.04); no new failures.

Thanks,
-- 
Paul Pluzhnikov

Attachment: libunwind-delay-dtor-20111019.txt
Description: Text document


reply via email to

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