Skip to content

Commit

Permalink
[fix](beut) fix core in exchange sink test (apache#47926)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

In BE_TEST, a query context is not initialized, resulting in a core
dump.
```
==1732796==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000001e0 (pc 0x55c664a74e74 bp 0x7ffcc76e9d20 sp 0x7ffcc76e9cf0 T0)
==1732796==The signal is caused by a READ memory access.
==1732796==Hint: address points to the zero page.
    #0 0x55c664a74e74 in std::__shared_ptr<doris::ResourceContext, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<doris::ResourceContext, (__gnu_cxx::_Lock_policy)2> const&) /mnt/disk6/common/ldb_toolchain_robin/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1522:7
    #1 0x55c664a74e0e in std::shared_ptr<doris::ResourceContext>::shared_ptr(std::shared_ptr<doris::ResourceContext> const&) /mnt/disk6/common/ldb_toolchain_robin/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:204:7
    #2 0x55c66878ff18 in doris::QueryContext::resource_ctx() /mnt/disk12/yanxuecheng/doris/be/src/runtime/query_context.h:292:62
    #3 0x55c69a2f2c19 in doris::vectorized::BlockSerializer::serialize_block(doris::vectorized::Block const*,
```

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [x] 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:
    - [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)

- [x] Confirm the release note
- [x] Confirm test cases
- [x] Confirm document
- [x] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
  • Loading branch information
Mryange authored Feb 14, 2025
1 parent 0b06f89 commit 68662f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions be/src/vec/sink/vdata_stream_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,12 @@ Status BlockSerializer::serialize_block(const Block* src, PBlock* dest, size_t n
COUNTER_UPDATE(_parent->_bytes_sent_counter, compressed_bytes * num_receivers);
COUNTER_UPDATE(_parent->_uncompressed_bytes_counter, uncompressed_bytes * num_receivers);
COUNTER_UPDATE(_parent->_compress_timer, src->get_compress_time());
#ifndef BE_TEST
_parent->state()->get_query_ctx()->resource_ctx()->io_context()->update_shuffle_send_bytes(
compressed_bytes * num_receivers);
_parent->state()->get_query_ctx()->resource_ctx()->io_context()->update_shuffle_send_rows(
src->rows() * num_receivers);
#endif

return Status::OK();
}
Expand Down

0 comments on commit 68662f9

Please sign in to comment.