Skip to content

[Bug](exchange) avoid coredump coz nullptr#57640

Merged
yiguolei merged 1 commit intoapache:branch-2.1from
BiteTheDDDDt:fix_1103_2
Nov 4, 2025
Merged

[Bug](exchange) avoid coredump coz nullptr#57640
yiguolei merged 1 commit intoapache:branch-2.1from
BiteTheDDDDt:fix_1103_2

Conversation

@BiteTheDDDDt
Copy link
Contributor

@BiteTheDDDDt BiteTheDDDDt commented Nov 3, 2025

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.

*** Current BE git commitID: 50e6e413f5 ***
*** 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

    • 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
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@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

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.43% (24048/33668)
Line Coverage 57.86% (250306/432604)
Region Coverage 53.09% (208360/392494)
Branch Coverage 54.75% (89402/163299)

zhangstar333
zhangstar333 previously approved these changes Nov 4, 2025
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

PR approved by anyone and no changes requested.

@BiteTheDDDDt BiteTheDDDDt changed the base branch from master to branch-2.1 November 4, 2025 08:04
@BiteTheDDDDt BiteTheDDDDt dismissed zhangstar333’s stale review November 4, 2025 08:04

The base branch was changed.

@BiteTheDDDDt
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 39.14% (10400/26568)
Line Coverage 30.13% (86252/286285)
Region Coverage 27.67% (49780/179936)
Branch Coverage 24.23% (24430/100826)

@BiteTheDDDDt BiteTheDDDDt changed the title [Chore](exchange) avoid coredump coz nullptr [Bug](exchange) avoid coredump coz nullptr Nov 4, 2025
@yiguolei yiguolei merged commit 15194aa into apache:branch-2.1 Nov 4, 2025
21 of 22 checks passed
BiteTheDDDDt added a commit to BiteTheDDDDt/incubator-doris that referenced this pull request Nov 4, 2025
### 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 -->
BiteTheDDDDt added a commit to BiteTheDDDDt/incubator-doris that referenced this pull request Nov 4, 2025
### 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 -->
yiguolei pushed a commit to yiguolei/incubator-doris that referenced this pull request Dec 30, 2025
### 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/3.1.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants