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

bugfix: teracli exit will core #737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/proto/rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class RpcClientBase {
RpcClientBase() : m_rpc_channel(NULL) {}
virtual ~RpcClientBase() {}

static void Shutdown() {
m_rpc_client.Shutdown();
}

protected:
virtual void ResetClient(const std::string& server_addr) {
std::map<std::string, sofa::pbrpc::RpcChannel*>::iterator it;
Expand Down
4 changes: 4 additions & 0 deletions src/proto/tabletnode_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ void TabletNodeClient::SetRpcOption(int32_t max_inflow, int32_t max_outflow,
pending_buffer_size, thread_num);
}

void TabletNodeClient::Shutdown() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RpcClientBase是TabletNodeClient和MasterClient共享的,所以这么改并不合适,实际上上面的SetRpcOption函数也没有存在的意义,正确的做法是直接调RpcClientBase::SetOption和RpcClientBase::Shutdown

RpcClientBase::Shutdown();
}

TabletNodeClient::TabletNodeClient(const std::string& server_addr,
int32_t rpc_timeout)
: RpcClient<TabletNodeServer::Stub>(server_addr),
Expand Down
1 change: 1 addition & 0 deletions src/proto/tabletnode_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TabletNodeClient : public RpcClient<TabletNodeServer::Stub> {
static void SetRpcOption(int32_t max_inflow = -1, int32_t max_outflow = -1,
int32_t pending_buffer_size = -1,
int32_t thread_num = -1);
static void Shutdown();

TabletNodeClient(const std::string& addr = "",
int32_t rpc_timeout = FLAGS_tera_rpc_timeout_period);
Expand Down
1 change: 1 addition & 0 deletions src/sdk/client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ClientImpl::ClientImpl(const std::string& user_identity,
}

ClientImpl::~ClientImpl() {
tabletnode::TabletNodeClient::Shutdown();
delete _cluster;
}

Expand Down