diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-02-26 11:44:33 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-02-26 11:44:33 +0000 |
commit | c792ab8d9ec9d4043f77dee41edb03a5f22b13c0 (patch) | |
tree | 92d3224b0479f518cb01caa45d1810bb58bae2e6 | |
parent | 8911d59a81ccd960e255a754d1083376919ed928 (diff) |
Explicitly shut down Protobuf library prior to distributor process exit
This avoids false positives from Valgrind et al about memory leaks.
The distributor is most susceptible to this false positive since
error reporting in the DocumentAPI protocol may cause Protobuf
descriptors to be lazily loaded when an incoming message fails to
be decoded (usually due to a missing document type).
-rw-r--r-- | storageserver/src/apps/storaged/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storageserver/src/apps/storaged/storage.cpp | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/storageserver/src/apps/storaged/CMakeLists.txt b/storageserver/src/apps/storaged/CMakeLists.txt index 0bb858f3e47..89f0a3488ce 100644 --- a/storageserver/src/apps/storaged/CMakeLists.txt +++ b/storageserver/src/apps/storaged/CMakeLists.txt @@ -9,4 +9,6 @@ vespa_add_executable(storageserver_storaged_app storageserver_storageapp ) +vespa_add_target_package_dependency(storageserver_storaged_app Protobuf) + install_absolute_symlink(vespa-storaged-bin sbin/vespa-distributord-bin) diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index c5398628f8d..fe3bf696e9a 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -20,6 +20,7 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/config/helper/configgetter.hpp> #include <vespa/vespalib/util/signalhandler.h> +#include <google/protobuf/message_lite.h> #include <iostream> #include <csignal> #include <cstdlib> @@ -203,6 +204,8 @@ int StorageApp::main(int argc, char **argv) vespalib::ShutdownGuard shutdownGuard(getMaxShutDownTime()); LOG(debug, "Attempting proper shutdown"); _process.reset(); + // Clean up Protobuf library globals to avoid false positive leak warnings from Valgrind et al. + google::protobuf::ShutdownProtobufLibrary(); LOG(debug, "Completed controlled shutdown."); return 0; } |