提交 1cd217ba 编写于 作者: A aprudaev 提交者: alexey-milovidov

Fix reload configuration memory leak (#892)

* On reload remove previous configuration from LayeredConfiguration.

* fix build
上级 d7c5acbd
......@@ -216,6 +216,7 @@ protected:
std::string config_path;
ConfigProcessor::LoadedConfig loaded_config;
Poco::Util::AbstractConfiguration * last_configuration = nullptr;
};
......
......@@ -477,7 +477,10 @@ void BaseDaemon::reloadConfiguration()
std::string log_command_line_option = config().getString("logger.log", "");
config_path = config().getString("config-file", "config.xml");
loaded_config = ConfigProcessor(false, true).loadConfig(config_path, /* allow_zk_includes = */ true);
config().add(loaded_config.configuration.duplicate(), PRIO_DEFAULT, false);
if (last_configuration != nullptr)
config().removeConfiguration(last_configuration);
last_configuration = loaded_config.configuration.duplicate();
config().add(last_configuration, PRIO_DEFAULT, false);
log_to_console = !config().getBool("application.runAsDaemon", false) && log_command_line_option.empty();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册