You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/11/11 09:59:10 UTC
[incubator-doris] branch master updated: [Bug] Use object to
replace pointer to avoid BE crash (#7024)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new c9023ac [Bug] Use object to replace pointer to avoid BE crash (#7024)
c9023ac is described below
commit c9023acca4bbd6697a8db5bf042e377109014edf
Author: thinker <zc...@qq.com>
AuthorDate: Thu Nov 11 17:58:58 2021 +0800
[Bug] Use object to replace pointer to avoid BE crash (#7024)
use `NodeInfo _node_info` to replace `NodeInfo *_node_info`
---
be/src/exec/tablet_info.h | 2 ++
be/src/exec/tablet_sink.cpp | 18 ++++++++++--------
be/src/exec/tablet_sink.h | 4 ++--
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/be/src/exec/tablet_info.h b/be/src/exec/tablet_info.h
index f88caec..7bb2640 100644
--- a/be/src/exec/tablet_info.h
+++ b/be/src/exec/tablet_info.h
@@ -243,6 +243,8 @@ struct NodeInfo {
std::string host;
int32_t brpc_port;
+ NodeInfo() = default;
+
NodeInfo(const TNodeInfo& tnode)
: id(tnode.id),
option(tnode.option),
diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp
index c6eb456..0ee71c5 100644
--- a/be/src/exec/tablet_sink.cpp
+++ b/be/src/exec/tablet_sink.cpp
@@ -62,22 +62,24 @@ NodeChannel::~NodeChannel() {
// returned directly via "TabletSink::prepare()" method.
Status NodeChannel::init(RuntimeState* state) {
_tuple_desc = _parent->_output_tuple_desc;
- _node_info = _parent->_nodes_info->find_node(_node_id);
- if (_node_info == nullptr) {
+ auto node = _parent->_nodes_info->find_node(_node_id);
+ if (node == nullptr) {
std::stringstream ss;
ss << "unknown node id, id=" << _node_id;
_cancelled = true;
return Status::InternalError(ss.str());
}
+ _node_info = *node;
+
_row_desc.reset(new RowDescriptor(_tuple_desc, false));
_batch_size = state->batch_size();
_cur_batch.reset(new RowBatch(*_row_desc, _batch_size, _parent->_mem_tracker.get()));
- _stub = state->exec_env()->brpc_stub_cache()->get_stub(_node_info->host, _node_info->brpc_port);
- if (!_stub) {
- LOG(WARNING) << "Get rpc stub failed, host=" << _node_info->host
- << ", port=" << _node_info->brpc_port;
+ _stub = state->exec_env()->brpc_stub_cache()->get_stub(_node_info.host, _node_info.brpc_port);
+ if (_stub == nullptr) {
+ LOG(WARNING) << "Get rpc stub failed, host=" << _node_info.host
+ << ", port=" << _node_info.brpc_port;
_cancelled = true;
return Status::InternalError("get rpc stub failed");
}
@@ -143,8 +145,8 @@ void NodeChannel::_cancel_with_msg(const std::string& msg) {
Status NodeChannel::open_wait() {
_open_closure->join();
if (_open_closure->cntl.Failed()) {
- if (!ExecEnv::GetInstance()->brpc_stub_cache()->available(_stub, _node_info->host,
- _node_info->brpc_port)) {
+ if (!ExecEnv::GetInstance()->brpc_stub_cache()->available(_stub, _node_info.host,
+ _node_info.brpc_port)) {
ExecEnv::GetInstance()->brpc_stub_cache()->erase(_open_closure->cntl.remote_side());
}
std::stringstream ss;
diff --git a/be/src/exec/tablet_sink.h b/be/src/exec/tablet_sink.h
index 216fdd6..f973221 100644
--- a/be/src/exec/tablet_sink.h
+++ b/be/src/exec/tablet_sink.h
@@ -203,7 +203,7 @@ public:
// FIXME(cmy): There is a problem that when calling node_info, the node_info seems not initialized.
// But I don't know why. so here I print node_info->id instead of node_info->host
// to avoid BE crash. It needs further observation.
- return fmt::format("{}, {}, node={}:{}", _name, _load_info, _node_info->id, _node_info->brpc_port);
+ return fmt::format("{}, {}, node={}:{}", _name, _load_info, _node_info.id, _node_info.brpc_port);
}
private:
@@ -218,7 +218,7 @@ private:
std::string _name;
TupleDescriptor* _tuple_desc = nullptr;
- const NodeInfo* _node_info = nullptr;
+ NodeInfo _node_info;
// this should be set in init() using config
int _rpc_timeout_ms = 60000;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org