Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed graphd startup issue #5493

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/graph/service/GraphServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@ bool GraphServer::start() {
} catch (const std::exception &e) {
FLOG_ERROR("Exception thrown while starting the graph RPC server: %s", e.what());
}
serverStatus_.store(STATUS_STOPPED);
{
std::unique_lock<std::mutex> lkStop(muStop_);
serverStatus_.store(STATUS_STOPPED);
cvStop_.notify_one();
}
FLOG_INFO("nebula-graphd on %s:%d has been stopped", localHost_.host.c_str(), localHost_.port);
});

while (serverStatus_ == STATUS_UNINITIALIZED) {
std::this_thread::sleep_for(std::chrono::microseconds(100));
std::this_thread::sleep_for(std::chrono::microseconds(1000));
}
// In case `thriftServer_->serve()` fails, we wait a short while
std::this_thread::sleep_for(std::chrono::microseconds(1000));
if (serverStatus_ != STATUS_RUNNING) {
return false;
}

return true;
}

Expand All @@ -89,10 +99,8 @@ void GraphServer::waitUntilStop() {

void GraphServer::notifyStop() {
std::unique_lock<std::mutex> lkStop(muStop_);
if (serverStatus_ == STATUS_RUNNING) {
serverStatus_ = STATUS_STOPPED;
cvStop_.notify_one();
}
serverStatus_ = STATUS_STOPPED;
cvStop_.notify_one();
}

// Stop the server.
Expand Down