From ab5a66e2c0ab6e1392f3c7ca855cd21462675ee6 Mon Sep 17 00:00:00 2001 From: Tudor Bosman Date: Mon, 24 Feb 2014 15:39:46 -0800 Subject: [PATCH] Leak ELF file cache that the signal handler uses Summary: so we can still handle signals during global destruction. (d'oh) Test Plan: unittests Reviewed By: philipp@fb.com FB internal diff: D1188159 --- folly/experimental/symbolizer/SignalHandler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/folly/experimental/symbolizer/SignalHandler.cpp b/folly/experimental/symbolizer/SignalHandler.cpp index 02e5ef05..79f17f98 100644 --- a/folly/experimental/symbolizer/SignalHandler.cpp +++ b/folly/experimental/symbolizer/SignalHandler.cpp @@ -193,7 +193,9 @@ constexpr size_t kDefaultCapacity = 500; // Note: not thread-safe, but that's okay, as we only let one thread // in our signal handler at a time. -SignalSafeElfCache signalSafeElfCache(kDefaultCapacity); +// +// Leak it so we don't have to worry about destruction order +auto gSignalSafeElfCache = new SignalSafeElfCache(kDefaultCapacity); } // namespace void dumpStackTrace(bool symbolize) __attribute__((noinline)); @@ -208,7 +210,7 @@ void dumpStackTrace(bool symbolize) { if (!getStackTraceSafe(addresses)) { print("(error retrieving stack trace)\n"); } else if (symbolize) { - Symbolizer symbolizer(&signalSafeElfCache); + Symbolizer symbolizer(gSignalSafeElfCache); symbolizer.symbolize(addresses); FDSymbolizePrinter printer(STDERR_FILENO, SymbolizePrinter::COLOR_IF_TTY); -- 2.34.1