From 636da0f327ac44dcd4241a1152e649770f507df5 Mon Sep 17 00:00:00 2001 From: morningman Date: Fri, 19 Jul 2019 09:23:07 +0800 Subject: [PATCH] Fix bug that BE may crash when closing OlapTableSink The `_profile` in OlapTableSink may not be initialized if `prepare()` method is not called. So when close the OlapTableSink, we should check if `_profile` is initialized. --- be/src/exec/tablet_sink.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp index 3be046a1c8069d..9cbdf76959e02f 100644 --- a/be/src/exec/tablet_sink.cpp +++ b/be/src/exec/tablet_sink.cpp @@ -588,9 +588,12 @@ Status OlapTableSink::send(RuntimeState* state, RowBatch* input_batch) { } Status OlapTableSink::close(RuntimeState* state, Status close_status) { - SCOPED_TIMER(_profile->total_time_counter()); Status status = close_status; if (status.ok()) { + // SCOPED_TIMER should only be called is status is ok. + // if status is not ok, this OlapTableSink may not be prepared, + // so the `_profile` may be null. + SCOPED_TIMER(_profile->total_time_counter()); { SCOPED_TIMER(_close_timer); for (auto channel : _channels) {