Skip to content

Commit 3e67eb8

Browse files
authored
Merge pull request ClickHouse#80714 from azat/dict-fix-crash
Fix possible crash in case of dictionary registration failed
2 parents bb07aa5 + 932d02c commit 3e67eb8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Interpreters/ExternalLoader.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,18 @@ scope_guard ExternalLoader::addConfigRepository(std::unique_ptr<IExternalLoaderC
12901290
auto * ptr = repository.get();
12911291
String name = ptr->getName();
12921292

1293-
config_files_reader->addConfigRepository(std::move(repository));
1294-
reloadConfig(name);
1293+
/// Avoid leaving dangling repository in case of reloadConfig() fails
1294+
/// (it can be possible in case of CANNOT_SCHEDULE_TASK)
1295+
try
1296+
{
1297+
config_files_reader->addConfigRepository(std::move(repository));
1298+
reloadConfig(name);
1299+
}
1300+
catch (...)
1301+
{
1302+
config_files_reader->removeConfigRepository(ptr);
1303+
throw;
1304+
}
12951305

12961306
return [this, ptr, name]()
12971307
{

0 commit comments

Comments
 (0)