@@ -159,15 +159,13 @@ struct ShutdownWatchdog {
159159};
160160
161161ShutdownWatchdog::ShutdownWatchdog (util::ProactorPool& pp) : pool{pp} {
162- watchdog_fb = pool.GetNextProactor ()->LaunchFiber ([&] {
163- util::ThisFiber::SetName (" shutdown-watchdog" );
164-
162+ watchdog_fb = pool.GetNextProactor ()->LaunchFiber (" shutdown_watchdog" , [&] {
165163 if (!watchdog_done.WaitFor (20s)) {
166164 LOG (ERROR) << " Deadlock detected during shutdown" ;
167165 absl::SetFlag (&FLAGS_alsologtostderr, true );
168166 util::fb2::Mutex m;
169167 pool.AwaitFiberOnAll ([&m](unsigned index, auto *) {
170- util::ThisFiber::SetName (" shutdown-watchdog " );
168+ util::ThisFiber::SetName (absl::StrFormat ( " print_stack_fib_%u " , index) );
171169 std::unique_lock lk (m);
172170 LOG (ERROR) << " Proactor " << index << " :\n " ;
173171 util::fb2::detail::FiberInterface::PrintAllFiberStackTraces ();
@@ -181,7 +179,7 @@ void ShutdownWatchdog::Disarm() {
181179 watchdog_fb.JoinIfNeeded ();
182180}
183181
184- std::optional<ShutdownWatchdog> swd = std::nullopt ;
182+ std::optional<ShutdownWatchdog> shutdown_watchdog = std::nullopt ;
185183
186184} // namespace
187185
@@ -1113,6 +1111,9 @@ void Service::Shutdown() {
11131111 cluster_family_.Shutdown ();
11141112
11151113 server_family_.Shutdown ();
1114+
1115+ shutdown_watchdog.emplace (pp_);
1116+
11161117 engine_varz.reset ();
11171118
11181119 ChannelStore::Destroy ();
@@ -1127,7 +1128,7 @@ void Service::Shutdown() {
11271128 ThisFiber::SleepFor (10ms);
11281129 facade::Connection::Shutdown ();
11291130
1130- DisarmShutdownWatchdog ();
1131+ shutdown_watchdog-> Disarm ();
11311132}
11321133
11331134OpResult<KeyIndex> Service::FindKeys (const CommandId* cid, CmdArgList args) {
@@ -3107,16 +3108,4 @@ const acl::AclFamily* Service::TestInit() {
31073108 return &acl_family_;
31083109}
31093110
3110- void ArmShutdownWatchdog (ProactorPool& pp) {
3111- if (!swd.has_value ()) {
3112- swd.emplace (pp);
3113- }
3114- }
3115-
3116- void DisarmShutdownWatchdog () {
3117- if (swd.has_value ()) {
3118- swd->Disarm ();
3119- }
3120- }
3121-
31223111} // namespace dfly
0 commit comments