Skip to content

Commit

Permalink
[BugFix] fix load channel crash when add chunk (StarRocks#25248)
Browse files Browse the repository at this point in the history
When load channel not open yet, the `_row_desc` will be null, avoid
dereference it when `add_chunk`. This will happen when rpc packets
arrive not in order.

crash stack:
```
(gdb) bt
#0  0x00000000057cd3e2 in starrocks::serde::build_protobuf_chunk_meta(starrocks::RowDescriptor const&, starrocks::ChunkPB const&) ()
#1  0x0000000004d1ee07 in starrocks::LoadChannel::_build_chunk_meta(starrocks::ChunkPB const&) ()
#2  0x0000000004d21816 in starrocks::LoadChannel::add_chunk(starrocks::PTabletWriterAddChunkRequest const&, starrocks::PTabletWriterAddBatchResult*) ()
#3  0x0000000004d1abb2 in starrocks::LoadChannelMgr::add_chunk(starrocks::PTabletWriterAddChunkRequest const&, starrocks::PTabletWriterAddBatchResult*) ()
StarRocks#4  0x0000000004dd0835 in starrocks::BackendInternalServiceImpldoris::PBackendService::tablet_writer_add_chunk(google::protobuf::RpcController*, starrocks::PTabletWriterAddChunkRequest const*, starrocks::PTabletWriterAddBatchResult*, google::protobuf::Closure*) ()
```
  • Loading branch information
luohaha authored Jun 20, 2023
1 parent 5fe3afc commit d5b5eae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions be/src/runtime/load_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ Status LoadChannel::_build_chunk_meta(const ChunkPB& pb_chunk) {
if (_has_chunk_meta.load(std::memory_order_acquire)) {
return Status::OK();
}
if (_row_desc == nullptr) {
return Status::InternalError(fmt::format("load channel not open yet, load id: {}", _load_id.to_string()));
}
StatusOr<serde::ProtobufChunkMeta> res = serde::build_protobuf_chunk_meta(*_row_desc, pb_chunk);
if (!res.ok()) return res.status();
_chunk_meta = std::move(res).value();
Expand Down

0 comments on commit d5b5eae

Please sign in to comment.