Skip to content

Conversation

@BiteTheDDDDt
Copy link
Contributor

pick from #57640

### What problem does this PR solve?
In some cases (such as when the operator is triggered to cancel before
opened), the operator close may encounter a core dump due to a nullptr.

```cpp
*** Current BE git commitID: 50e6e41 ***
*** SIGSEGV unknown detail explain (@0x0) received by PID 3836583 (TID 3840122 OR 0x7f840373a700) from PID 0; 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:421
 1# os::Linux::chained_handler(int, siginfo_t*, void*) in /data1/doris/java8/jre/lib/amd64/server/libjvm.so
 2# JVM_handle_linux_signal in /data1/doris/java8/jre/lib/amd64/server/libjvm.so
 3# signalHandler(int, siginfo_t*, void*) in /data1/doris/java8/jre/lib/amd64/server/libjvm.so
 4# 0x00007F8FC93CD880 in /lib64/libc.so.6
 5# doris::pipeline::ExchangeSinkLocalState::close(doris::RuntimeState*, doris::Status) at /home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/exec/exchange_sink_operator.cpp:759
 6# doris::pipeline::DataSinkOperatorXBase::close(doris::RuntimeState*, doris::Status) at /home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/pipeline_x/operator.h:664
 7# doris::pipeline::PipelineXTask::close(doris::Status, bool) at /home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/pipeline_x/pipeline_x_task.cpp:462
 8# doris::pipeline::_close_task(doris::pipeline::PipelineTask*, doris::pipeline::PipelineTaskState, doris::Status) at /home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/task_scheduler.cpp:246
 9# doris::pipeline::TaskScheduler::_do_work(unsigned long) at /home/zcp/repo_center/doris_enterprise/doris/be/src/pipeline/task_scheduler.cpp:288
10# doris::ThreadPool::dispatch_thread() in /data1/doris/be/lib/doris_be
11# doris::Thread::supervise_thread(void*) at /home/zcp/repo_center/doris_enterprise/doris/be/src/util/thread.cpp:499
12# start_thread in /lib64/libpthread.so.0
13# clone in /lib64/libc.so.6
```
This pull request makes a small improvement to the
`ExchangeSinkLocalState::close` method by adding a null check before
updating channel timers, which helps prevent potential crashes or
undefined behavior.

### 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)
    - [x] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [x] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [x] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#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 -->
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@BiteTheDDDDt
Copy link
Contributor Author

run buildall

@morrySnow morrySnow changed the title [Bug](exchange) avoid coredump coz nullptr (#57640) branch-3.1: [Bug](exchange) avoid coredump coz nullptr #57640 Nov 7, 2025
@morrySnow morrySnow merged commit ec8ff57 into apache:branch-3.1 Nov 7, 2025
22 of 23 checks passed
@morrySnow morrySnow mentioned this pull request Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants