Fix milvus crash when exiting (#3333)

* Fix server crash when exiting

Signed-off-by: yinghao.zou <yinghao.zou@zilliz.com>

* Simplify web server

Signed-off-by: yinghao.zou <yinghao.zou@zilliz.com>
pull/3343/head
BossZou 2020-08-19 23:17:24 +08:00 committed by GitHub
parent 05a602fecc
commit 81791fc803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 5 deletions

View File

@ -240,8 +240,8 @@ endif ()
if (DEFINED ENV{MILVUS_OATPP_URL})
set(OATPP_SOURCE_URL "$ENV{MILVUS_OATPP_URL}")
else ()
set(OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz")
# set(OATPP_SOURCE_URL "https://github.com/BossZou/oatpp/archive/${OATPP_VERSION}.zip")
set(OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz")
# set(OATPP_SOURCE_URL "https://github.com/BossZou/oatpp/archive/${OATPP_VERSION}.zip")
endif ()
if (DEFINED ENV{MILVUS_AWS_URL})

View File

@ -102,6 +102,7 @@ StopSchedulerService() {
JobMgrInst::GetInstance()->Stop();
SchedInst::GetInstance()->Stop();
ResMgrInst::GetInstance()->Stop();
OptimizerInst::GetInstance()->Stop();
}
} // namespace scheduler

View File

@ -32,5 +32,10 @@ Optimizer::Run(const TaskPtr& task) {
return false;
}
void
Optimizer::Stop() {
pass_list_ = std::vector<PassPtr>();
}
} // namespace scheduler
} // namespace milvus

View File

@ -38,6 +38,9 @@ class Optimizer {
bool
Run(const TaskPtr& task);
void
Stop();
private:
std::vector<PassPtr> pass_list_;
};

View File

@ -65,13 +65,10 @@ WebServer::StartService() {
}
server.stop();
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, client_provider);
client_provider->getConnection();
});
// start synchronously
server.run();
connection_handler->stop();
stop_thread.join();
}
oatpp::base::Environment::destroy();