diff options
author | leonidlazarev <leonidlazarev@yandex-team.com> | 2023-05-22 12:29:23 +0300 |
---|---|---|
committer | leonidlazarev <leonidlazarev@yandex-team.com> | 2023-05-22 12:29:23 +0300 |
commit | 1f69bcf7cb932454c79897d3c2ee8d530382d5ce (patch) | |
tree | 1798a5226a8873dbd1bf0a1b6d615be7a3975b16 | |
parent | 7e30013ec8d66953ed20fa0f332a4bcd021756b9 (diff) | |
download | ydb-1f69bcf7cb932454c79897d3c2ee8d530382d5ce.tar.gz |
feat grpc: correct order of the fork variable set
Correct order of the GRPC_ENABLE_FORK_SUPPORT set
-rw-r--r-- | library/cpp/unified_agent_client/client_impl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/cpp/unified_agent_client/client_impl.cpp b/library/cpp/unified_agent_client/client_impl.cpp index 4db98120fd..ec003df948 100644 --- a/library/cpp/unified_agent_client/client_impl.cpp +++ b/library/cpp/unified_agent_client/client_impl.cpp @@ -237,7 +237,6 @@ namespace NUnifiedAgent::NPrivate { with_lock(InstanceLock) { auto result = Instance.lock(); if (!result && createIfNotExists) { - SetEnv("GRPC_ENABLE_FORK_SUPPORT", "true"); result = std::make_shared<TForkProtector>(); if (!result->Enabled) { TLog log("cerr"); @@ -1259,6 +1258,16 @@ namespace NUnifiedAgent { const TDuration TClientParameters::DefaultGrpcSendDelay = TDuration::MilliSeconds(10); TClientPtr MakeClient(const TClientParameters& parameters) { + + // Initialization of the Fork in newest grcp core is performed + // in 'do_basic_init', which is called inside 'grpc_is_initialized'. + // So the set of the fork env variable has to be done before + // grpc_is_initialized call. +#ifdef _unix_ + if (parameters.EnableForkSupport) { + SetEnv("GRPC_ENABLE_FORK_SUPPORT", "true"); + } +#endif if (!grpc_is_initialized()) { EnsureGrpcConfigured(); } |