Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit 116cefb

Browse files
AhmedSolimanfacebook-github-bot
authored andcommitted
Fixing LCM startup correctness after D17824825
Summary: This fixes a critical issue that was caused by D17824825 (cc. Vijaykumar) where for a short period of time we can have a nullptr logsconfig in the updateble logs config. In a race, the RSMs will attempt to locate sequencers for internal logs before LogsConfigManager executes its `start()` call, causing a null deref (undefined behaviour) ASAN catches this on AdminServer startup in dev builds. Not really sure why this isn't visible on our integration tests (possibly will appear on stress tests) Reviewed By: mcrnic Differential Revision: D17978655 fbshipit-source-id: cb384e75b18dd8c04f7afbdf9e601f51bc5f69e1
1 parent 96867f6 commit 116cefb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

logdevice/common/configuration/Configuration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void Configuration::getLogGroupByIDAsync(
6767
if (MetaDataLog::isMetaDataLog(id)) {
6868
cb(server_config_->getMetaDataLogGroup());
6969
} else {
70+
ld_check(logs_config_);
7071
logs_config_->getLogGroupByIDAsync(id, cb);
7172
}
7273
}

logdevice/common/configuration/logs/LogsConfigManager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ bool LogsConfigManager::createAndAttach(Processor& processor,
5959
std::unique_ptr<Request> req =
6060
std::make_unique<StartLogsConfigManagerRequest>(std::move(manager));
6161

62-
const int rv = processor.postRequest(req);
62+
// We want to make sure that LCM has called start() (if needed) before the
63+
// rest of the components execute their work, this ensures that the empty
64+
// LogsConfig is published before the rest of dependencies.
65+
const int rv = processor.blockingRequest(req);
6366
if (rv != 0) {
6467
ld_error("Cannot post request to start logs config manager: %s (%s)",
6568
error_name(err),

0 commit comments

Comments
 (0)