Skip to content

Commit

Permalink
Fix deadlock in standalone mcrouter on invalid config
Browse files Browse the repository at this point in the history
  • Loading branch information
mszabo-wikia committed Dec 10, 2024
1 parent b2aaff7 commit 4904ec5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mcrouter/Server-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,6 @@ bool runServerDual(
auto evbs = extractEvbs(*ioThreadPool);
CHECK_EQ(evbs.size(), mcrouterOpts.num_proxies);

// Create AsyncMcServer instance
asyncMcServer =
std::make_shared<AsyncMcServer>(detail::createAsyncMcServerOptions(
mcrouterOpts, standaloneOpts, &evbs));

// Create CarbonRouterInstance
if (standaloneOpts.remote_thread) {
router =
Expand All @@ -328,6 +323,11 @@ bool runServerDual(
return false;
}

// Create AsyncMcServer instance
asyncMcServer =
std::make_shared<AsyncMcServer>(detail::createAsyncMcServerOptions(
mcrouterOpts, standaloneOpts, &evbs));

setupRouter<RouterInfo>(mcrouterOpts, standaloneOpts, router, preRunCb);

// Create CarbonRouterClients for each worker thread
Expand Down Expand Up @@ -515,10 +515,6 @@ bool runServer(
// Get EVB of main thread
auto localEvb = ioThreadPool->getEventBaseManager()->getEventBase();

asyncMcServer =
std::make_shared<AsyncMcServer>(detail::createAsyncMcServerOptions(
mcrouterOpts, standaloneOpts, &evbs));

if (standaloneOpts.remote_thread) {
router =
CarbonRouterInstance<RouterInfo>::init("standalone", mcrouterOpts);
Expand All @@ -531,6 +527,10 @@ bool runServer(
return false;
}

asyncMcServer =
std::make_shared<AsyncMcServer>(detail::createAsyncMcServerOptions(
mcrouterOpts, standaloneOpts, &evbs));

setupRouter<RouterInfo>(mcrouterOpts, standaloneOpts, router, preRunCb);

auto shutdownStarted = std::make_shared<std::atomic<bool>>(false);
Expand Down

0 comments on commit 4904ec5

Please sign in to comment.