aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsomov <somov@yandex-team.com>2023-06-05 23:50:16 +0300
committersomov <somov@yandex-team.com>2023-06-05 23:50:16 +0300
commita11456853376619a0b5e3b5186434afd579608a4 (patch)
tree450140512efc8e6fbc375d71bcf0143e633ca253
parent83d6040b98ea02640e30eb9728eff71a38d7e637 (diff)
downloadydb-a11456853376619a0b5e3b5186434afd579608a4.tar.gz
Fix gRPC hanging after fork
-rw-r--r--contrib/libs/grpc/src/core/lib/event_engine/forkable.cc1
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc4
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/contrib/libs/grpc/src/core/lib/event_engine/forkable.cc b/contrib/libs/grpc/src/core/lib/event_engine/forkable.cc
index f904765c50..af9f8b51da 100644
--- a/contrib/libs/grpc/src/core/lib/event_engine/forkable.cc
+++ b/contrib/libs/grpc/src/core/lib/event_engine/forkable.cc
@@ -60,6 +60,7 @@ void PostforkParent() {
}
void PostforkChild() {
+ y_absl::ResetDeadlockGraphMu();
grpc_core::MutexLock lock(g_mu.get());
for (auto* forkable : *g_forkables) {
forkable->PostforkChild();
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc
index a8a6ca8d67..43ab36fe07 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc
@@ -246,6 +246,10 @@ static void AtomicClearBits(std::atomic<intptr_t>* pv, intptr_t bits,
Y_ABSL_CONST_INIT static y_absl::base_internal::SpinLock deadlock_graph_mu(
y_absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+void ResetDeadlockGraphMu() {
+ new (&deadlock_graph_mu) y_absl::base_internal::SpinLock{y_absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY};
+}
+
// Graph used to detect deadlocks.
Y_ABSL_CONST_INIT static GraphCycles *deadlock_graph
Y_ABSL_GUARDED_BY(deadlock_graph_mu) Y_ABSL_PT_GUARDED_BY(deadlock_graph_mu);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.h b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.h
index 4b0b54b1fb..7f1d5b0832 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.h
@@ -1086,6 +1086,8 @@ Y_ABSL_DEPRECATED("y_absl::RegisterSymbolizer() is deprecated and will be remove
"on or after 2023-05-01")
void RegisterSymbolizer(bool (*fn)(const void *pc, char *out, int out_size));
+void ResetDeadlockGraphMu();
+
// EnableMutexInvariantDebugging()
//
// Enable or disable global support for Mutex invariant debugging. If enabled,