This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 6701bc7746b branch-2.0: [Bug](fix) Fix QueryStatistics thread-unsafe 
(#46980)
6701bc7746b is described below

commit 6701bc7746b508a5cddba34cb65ebb3662778e66
Author: Xinyi Zou <zouxi...@selectdb.com>
AuthorDate: Tue Jan 14 22:51:19 2025 +0800

    branch-2.0: [Bug](fix) Fix QueryStatistics thread-unsafe (#46980)
    
    ### What problem does this PR solve?
    
    fix:
    ```
    *** Query id: fe05209ae622498b-9a2710f32b3dbcac ***
    *** tablet id: 0 ***
    *** Aborted at 1736818365 (unix time) try "date -d @1736818365" if you are 
using GNU date ***
    *** Current BE git commitID: f129a5c1278 ***
    *** SIGSEGV address not mapped to object (@0x35) received by PID 2827018 
(TID 2827438 OR 0xffff00d47f40) from PID 53; stack trace: ***
     0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, 
siginfo_t*, void*) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/common/signal_handler.h:417
     1# os::Linux::chained_handler(int, siginfo_t*, void*) in 
/software/selectdb_doris/java8/jre/lib/aarch64/server/libjvm.so
     2# JVM_handle_linux_signal in 
/software/selectdb_doris/java8/jre/lib/aarch64/server/libjvm.so
     3# signalHandler(int, siginfo_t*, void*) in 
/software/selectdb_doris/java8/jre/lib/aarch64/server/libjvm.so
     4# 0x0000FFFFF7FB07BC in linux-vdso.so.1
     5# 
doris::QueryStatisticsRecvr::insert(std::shared_ptr<doris::QueryStatistics>, 
int) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/runtime/query_statistics.cpp:128
     6# doris::vectorized::VDataStreamRecvr::remove_sender(int, int, 
std::shared_ptr<doris::QueryStatistics>) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/runtime/vdata_stream_recvr.cpp:416
     7# doris::vectorized::Channel::send_local_block(bool, doris::Status 
const&) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/sink/vdata_stream_sender.cpp:138
     8# doris::vectorized::PipChannel::send_current_block(bool, doris::Status 
const&) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/sink/vdata_stream_sender.h:496
     9# doris::vectorized::Channel::close_internal(doris::Status const&) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/sink/vdata_stream_sender.cpp:287
    10# doris::vectorized::Channel::close(doris::RuntimeState*, doris::Status 
const&) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/sink/vdata_stream_sender.cpp:317
    11# doris::vectorized::VDataStreamSender::try_close(doris::RuntimeState*, 
doris::Status) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/vec/sink/vdata_stream_sender.cpp:707
    12# 
doris::pipeline::DataSinkOperator<doris::pipeline::ExchangeSinkOperatorBuilder>::try_close(doris::RuntimeState*)
 at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/exec/operator.h:293
    13# doris::pipeline::PipelineTask::try_close() at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/pipeline_task.cpp:315
    14# 
doris::pipeline::TaskScheduler::_try_close_task(doris::pipeline::PipelineTask*, 
doris::pipeline::PipelineTaskState) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/task_scheduler.cpp:342
    15# doris::pipeline::TaskScheduler::_do_work(unsigned long) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/task_scheduler.cpp:298
    16# doris::ThreadPool::dispatch_thread() at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/util/threadpool.cpp:541
    17# doris::Thread::supervise_thread(void*) at 
/home/zcp/repo_center/doris_enterprise/doris/be/src/util/thread.cpp:499
    18# 0x0000FFFFF7EC87A0 in /usr/lib64/libpthread.so.0
    19# 0x0000FFFFF7D2BCBC in /usr/lib64/libc.so.6
    ```
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/runtime/query_statistics.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/runtime/query_statistics.cpp 
b/be/src/runtime/query_statistics.cpp
index 0a20f6d6e0a..754baa7a7b7 100644
--- a/be/src/runtime/query_statistics.cpp
+++ b/be/src/runtime/query_statistics.cpp
@@ -131,8 +131,8 @@ void QueryStatisticsRecvr::insert(const PQueryStatistics& 
statistics, int sender
 
 void QueryStatisticsRecvr::insert(QueryStatisticsPtr statistics, int 
sender_id) {
     if (!statistics->collected()) return;
-    if (_query_statistics.contains(sender_id)) return;
     std::lock_guard<SpinLock> l(_lock);
+    if (_query_statistics.contains(sender_id)) return;
     _query_statistics[sender_id] = statistics;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to