From 4a08d81acff3aa5018c0efd63cd347341afe3211 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 8 Jan 2025 21:09:33 +0800 Subject: [PATCH] [fix](set operator) Fix invalid access in set operator (#46528) (#46613) Introduced by #45207. For a query plan, ``` set sink operator -- -| |-> set source operator set probe operator --| ``` If `set source operators` are finished (due to limit reached), all upstream operators could be finished and waken up at the same time. However, some states are initialized in `set sink operator`. So if `set probe operator` executes before `set sink operator` initialization, it will incur an invalid address access. *** Query id: cebb723bbda64249-9ab8c9e7aa72c540 *** *** is nereids: 1 *** *** tablet id: 0 *** *** Aborted at 1736092087 (unix time) try "date -d @1736092087" if you are using GNU date *** *** Current BE git commitID: 26d68d778a *** *** SIGSEGV address not mapped to object (@0xf8) received by PID 23579 (TID 26524 OR 0x7f84d4240640) from PID 248; stack trace: *** 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) at /home/zcp/repo_center/doris_master/doris/be/src/common/signal_handler.h:421 1# PosixSignals::chained_handler(int, siginfo*, void*) [clone .part.0] in /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so 2# JVM_handle_linux_signal in /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so 3# 0x00007F88F4063520 in /lib/x86_64-linux-gnu/libc.so.6 4# doris::pipeline::SetProbeSinkOperatorX::_finalize_probe(doris::pipeline::SetProbeSinkLocalState&) at /home/zcp/repo_center/doris_master/doris/be/src/pipeline/exec/set_probe_sink_operator.cpp:183 5# doris::pipeline::SetProbeSinkOperatorX::sink(doris::RuntimeState*, doris::vectorized::Block*, bool) at /home/zcp/repo_center/doris_master/doris/be/src/pipeline/exec/set_probe_sink_operator.cpp:99 6# doris::pipeline::PipelineTask::execute(bool*) at /home/zcp/repo_center/doris_master/doris/be/src/pipeline/pipeline_task.cpp:383 7# doris::pipeline::TaskScheduler::_do_work(int) at /home/zcp/repo_center/doris_master/doris/be/src/pipeline/task_scheduler.cpp:138 8# doris::ThreadPool::dispatch_thread() in /mnt/hdd01/ci/master-deploy/be/lib/doris_be 9# doris::Thread::supervise_thread(void*) at /home/zcp/repo_center/doris_master/doris/be/src/util/thread.cpp:499 10# start_thread at ./nptl/pthread_create.c:442 11# 0x00007F88F4147850 at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:83 --- be/src/pipeline/exec/set_probe_sink_operator.cpp | 7 +++---- be/src/pipeline/pipeline_x/dependency.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/be/src/pipeline/exec/set_probe_sink_operator.cpp b/be/src/pipeline/exec/set_probe_sink_operator.cpp index 744c8b17e2..7688bce00e 100644 --- a/be/src/pipeline/exec/set_probe_sink_operator.cpp +++ b/be/src/pipeline/exec/set_probe_sink_operator.cpp @@ -123,8 +123,8 @@ Status SetProbeSinkOperatorX::sink(RuntimeState* state, vectorized process_hashtable_ctx(&local_state, probe_rows); return process_hashtable_ctx.mark_data_in_hashtable(arg); } else { - LOG(FATAL) << "FATAL: uninited hash table"; - __builtin_unreachable(); + LOG(WARNING) << "Uninited hash table in Set Probe Sink Operator"; + return Status::OK(); } }, *local_state._shared_state->hash_table_variants)); @@ -283,8 +283,7 @@ void SetProbeSinkOperatorX::_refresh_hash_table( arg.hash_table = std::move(tmp_hash_table); } } else { - LOG(FATAL) << "FATAL: uninited hash table"; - __builtin_unreachable(); + LOG(WARNING) << "Uninited hash table in Set Probe Sink Operator"; } }, *hash_table_variants); diff --git a/be/src/pipeline/pipeline_x/dependency.h b/be/src/pipeline/pipeline_x/dependency.h index dfdb13b441..be28769272 100644 --- a/be/src/pipeline/pipeline_x/dependency.h +++ b/be/src/pipeline/pipeline_x/dependency.h @@ -613,7 +613,7 @@ public: /// init in setup_local_state std::unique_ptr hash_table_variants = - nullptr; // the real data HERE. + std::make_unique(); // the real data HERE. std::vector build_not_ignore_null; /// init in both upstream side.