From 37800b29067758c78aaa64539582a2854973d9cb Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Mon, 15 Aug 2022 10:20:34 -0700 Subject: [PATCH] Ensure iomgr does not track Forkable threads (#30572) * Ensure iomgr does not track Forkable threads New uses of grpc_core::Thread should not be tracked by iomgr. It would be nice to enforce this, but that can come later. This should unblock python releases. * tell parent & child that forking is complete --- src/core/lib/event_engine/posix_engine/timer_manager.cc | 7 +++++-- src/core/lib/event_engine/thread_pool.cc | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/lib/event_engine/posix_engine/timer_manager.cc b/src/core/lib/event_engine/posix_engine/timer_manager.cc index 633831d7e70..65659b3ce17 100644 --- a/src/core/lib/event_engine/posix_engine/timer_manager.cc +++ b/src/core/lib/event_engine/posix_engine/timer_manager.cc @@ -62,8 +62,9 @@ void TimerManager::StartThread() { ++thread_count_; auto* thread = new RunThreadArgs(); thread->self = this; - thread->thread = - grpc_core::Thread("timer_manager", &TimerManager::RunThread, thread); + thread->thread = grpc_core::Thread( + "timer_manager", &TimerManager::RunThread, thread, nullptr, + grpc_core::Thread::Options().set_tracked(false)); thread->thread.Start(); } @@ -273,6 +274,7 @@ void TimerManager::PostforkParent() { StartThread(); } prefork_thread_count_ = 0; + forking_ = false; } void TimerManager::PostforkChild() { @@ -281,6 +283,7 @@ void TimerManager::PostforkChild() { StartThread(); } prefork_thread_count_ = 0; + forking_ = false; } } // namespace posix_engine diff --git a/src/core/lib/event_engine/thread_pool.cc b/src/core/lib/event_engine/thread_pool.cc index efe288d5c5f..ddc6c713597 100644 --- a/src/core/lib/event_engine/thread_pool.cc +++ b/src/core/lib/event_engine/thread_pool.cc @@ -32,7 +32,7 @@ ThreadPool::Thread::Thread(ThreadPool* pool) thd_( "posix_eventengine_pool", [](void* th) { static_cast(th)->ThreadFunc(); }, - this) { + this, nullptr, grpc_core::Thread::Options().set_tracked(false)) { thd_.Start(); } ThreadPool::Thread::~Thread() { thd_.Join(); }