From: Lucian Grijincu Date: Fri, 7 Oct 2016 19:58:50 +0000 (-0700) Subject: folly: symbolizer: increase default signal-handler symbolizer elf file cache size... X-Git-Tag: v2016.10.10.00~5 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=bde0ad1fbe2404b0c58c57986ad940828d81ce8b folly: symbolizer: increase default signal-handler symbolizer elf file cache size (make it work with large number of .so) Summary: Bump the default size so we can symbolize symbols in dynamically linked binaries with lots and lots of shared libraries :) folly/experimental/symbolizer/ElfCache.h ``` * Will not grow; once the capacity is reached, lookups for files that * aren't already in the cache will fail (return nullptr). class SignalSafeElfCache ``` Reviewed By: ot, philippv Differential Revision: D3984649 fbshipit-source-id: acdca9b9adf6c16f3a1556bc3f57b28844cdd9cc --- diff --git a/folly/experimental/symbolizer/SignalHandler.cpp b/folly/experimental/symbolizer/SignalHandler.cpp index 164391c0..5319b11a 100644 --- a/folly/experimental/symbolizer/SignalHandler.cpp +++ b/folly/experimental/symbolizer/SignalHandler.cpp @@ -124,13 +124,11 @@ void callPreviousSignalHandler(int signum) { raise(signum); } -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. // // Leak it so we don't have to worry about destruction order -auto gSignalSafeElfCache = new SignalSafeElfCache(kDefaultCapacity); +auto gSignalSafeElfCache = new SignalSafeElfCache(kFatalSignalHandlerCacheSize); // Buffered writer (using a fixed-size buffer). We try to write only once // to prevent interleaving with messages written from other threads. diff --git a/folly/experimental/symbolizer/SignalHandler.h b/folly/experimental/symbolizer/SignalHandler.h index 726c8a81..7bb69643 100644 --- a/folly/experimental/symbolizer/SignalHandler.h +++ b/folly/experimental/symbolizer/SignalHandler.h @@ -29,6 +29,14 @@ namespace folly { namespace symbolizer { */ void installFatalSignalHandler(); +/** + * NOTE: The signal handler cache has a fixed size. ELF files for the + * binary and DSOs are added to the cache but never removed. + * + * Addresses from ELF files not in the cache will (silently) NOT be symbolized. + */ +constexpr size_t kFatalSignalHandlerCacheSize = 10000; + /** * Add a callback to be run when receiving a fatal signal. They will also * be called by LOG(FATAL) and abort() (as those raise SIGABRT internally).