[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] [patch] Fix for fast unwind and tcmalloc not playi
Re: [Libunwind-devel] [patch] Fix for fast unwind and tcmalloc not playing well together.
Thu, 20 Oct 2011 11:55:29 +0200
> 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!
Nice, glad to hear it's working for you :-)
> 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.
Didn't test this yet, but looks very reasonable to me. I'll spin some tests on
this with our software chain (also with Konstantin's patch for FreeBSD) next