Commit bde0ad1f authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Facebook Github Bot

folly: symbolizer: increase default signal-handler symbolizer elf file cache...

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
parent 46930a2a
...@@ -124,13 +124,11 @@ void callPreviousSignalHandler(int signum) { ...@@ -124,13 +124,11 @@ void callPreviousSignalHandler(int signum) {
raise(signum); raise(signum);
} }
constexpr size_t kDefaultCapacity = 500;
// Note: not thread-safe, but that's okay, as we only let one thread // Note: not thread-safe, but that's okay, as we only let one thread
// in our signal handler at a time. // in our signal handler at a time.
// //
// Leak it so we don't have to worry about destruction order // 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 // Buffered writer (using a fixed-size buffer). We try to write only once
// to prevent interleaving with messages written from other threads. // to prevent interleaving with messages written from other threads.
......
...@@ -29,6 +29,14 @@ namespace folly { namespace symbolizer { ...@@ -29,6 +29,14 @@ namespace folly { namespace symbolizer {
*/ */
void installFatalSignalHandler(); 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 * 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). * be called by LOG(FATAL) and abort() (as those raise SIGABRT internally).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment