folly: symbolizer: increase default signal-handler symbolizer elf file cache size...
authorLucian Grijincu <lucian@fb.com>
Fri, 7 Oct 2016 19:58:50 +0000 (12:58 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Fri, 7 Oct 2016 20:08:37 +0000 (13:08 -0700)
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

folly/experimental/symbolizer/SignalHandler.cpp
folly/experimental/symbolizer/SignalHandler.h

index 164391c02621a79c8eef3cbe5aa7c3753018d26d..5319b11a0e39df9dde41da1b921bf8d741c83920 100644 (file)
@@ -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.
index 726c8a81e707bf10c1dc156485e5252ccad501cf..7bb696431b29fc4f968bfd3977895e3afe387998 100644 (file)
@@ -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).