From a61a47a49b349b2411e4775e0826104943651e16 Mon Sep 17 00:00:00 2001 From: dinghao Date: Sat, 27 Jun 2020 14:57:26 +0800 Subject: [PATCH] fix serving same port bug --- serving/core/server.cc | 5 +++++ serving/scripts/format_source_code.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/serving/core/server.cc b/serving/core/server.cc index 4a3a3b59eb..c07558a5c2 100644 --- a/serving/core/server.cc +++ b/serving/core/server.cc @@ -273,6 +273,11 @@ Status Server::BuildAndStart() { builder.RegisterService(&service); // Finally assemble the server. std::unique_ptr server(builder.BuildAndStart()); + if (server == nullptr) { + MS_LOG(ERROR) << "The serving server create failed"; + ClearEnv(); + return FAILED; + } auto grpc_server_run = [&server]() { server->Wait(); }; std::thread serving_thread(grpc_server_run); MS_LOG(INFO) << "Server listening on " << server_address << std::endl; diff --git a/serving/scripts/format_source_code.sh b/serving/scripts/format_source_code.sh index 1a4c232567..829a0d3322 100755 --- a/serving/scripts/format_source_code.sh +++ b/serving/scripts/format_source_code.sh @@ -81,7 +81,7 @@ function checkopts() checkopts "$@" # switch to project root path, which contains clang-format config file '.clang-format' -cd "${SCRIPTS_PATH}/.." || exit 1 +cd "${SCRIPTS_PATH}/../.." || exit 1 FMT_FILE_LIST='__format_files_list__'