[fix](cloud) Fix lifecycle in lambda function#53605
Merged
Gabriel39 merged 3 commits intoapache:masterfrom Jul 22, 2025
Merged
Conversation
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 34212 ms |
TPC-DS: Total hot run time: 189958 ms |
ClickBench: Total hot run time: 33.19 s |
Contributor
Author
|
run buildall |
gavinchou
reviewed
Jul 21, 2025
be/src/cloud/cloud_meta_mgr.cpp
Outdated
| } | ||
|
|
||
| Status bthread_fork_join(const std::vector<std::function<Status()>>& tasks, int concurrency, | ||
| Status bthread_fork_join(const std::vector<std::function<Status()>>&& tasks, int concurrency, |
Contributor
There was a problem hiding this comment.
is modifier const necessary? it seems does not make sense.
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 34487 ms |
TPC-DS: Total hot run time: 191479 ms |
ClickBench: Total hot run time: 32.78 s |
gavinchou
approved these changes
Jul 21, 2025
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
w41ter
approved these changes
Jul 21, 2025
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Gabriel39
added a commit
to Gabriel39/incubator-doris
that referenced
this pull request
Jul 22, 2025
==15185==ERROR: AddressSanitizer: heap-use-after-free on address 0x7da44ced96d0 at pc 0x55795dac5f46 bp 0x7bc26b9a3e50 sp 0x7bc26b9a3e48 READ of size 8 at 0x7da44ced96d0 thread T1357 #0 0x55795dac5f45 in std::_Function_base::_M_empty() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:249:37 apache#1 0x55795dac5f45 in std::function<doris::Status ()>::operator()() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:591:6 apache#2 0x55795dac5f45 in doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0::operator()() const /root/doris/be/src/cloud/cloud_meta_mgr.cpp:106:23 apache#3 0x55795dac5f45 in void std::_invoke_impl<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&>(std::_invoke_other, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:63:14 apache#4 0x55795dac5f45 in std::enable_if<is_invocable_r_v<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$0&>, void>::type std::_invoke_r<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&>(doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:113:2 apache#5 0x55795dac5f45 in std::_Function_handler<void (), doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0>::_M_invoke(std::_Any_data const&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:292:9 apache#6 0x55795da78d1d in std::function<void ()>::operator()() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:593:9 apache#7 0x55795da78d1d in doris::cloud::run_bthread_work(void*) /root/doris/be/src/cloud/cloud_meta_mgr.cpp:74:5 apache#8 0x55795f3da334 in bthread::TaskGroup::task_runner(long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x50a4e334) apache#9 0x55795f3ccc80 in bthread_make_fcontext (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x50a40c80) 0x7da44ced96d0 is located 2640 bytes inside of 2688-byte region [0x7da44ced8c80,0x7da44ced9700) freed by thread T1431 here: #0 0x5579380e1f12 in operator delete(void*, unsigned long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x29755f12) previously allocated by thread T795 (brpc_light) here: #0 0x5579380e12ad in operator new(unsigned long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x297552ad) apache#1 0x55795c7b57ab in std::__new_allocator<std::function<doris::Status ()>>::allocate(unsigned long, void const*) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/new_allocator.h:151:27 apache#2 0x55795c7b57ab in std::allocator<std::function<doris::Status ()>>::allocate(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/allocator.h:203:32 apache#3 0x55795c7b57ab in std::allocator_traits<std::allocator<std::function<doris::Status ()>>>::allocate(std::allocator<std::function<doris::Status ()>>&, unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/alloc_traits.h:614:20 apache#4 0x55795c7b57ab in std::_Vector_base<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>>::_M_allocate(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_vector.h:387:20 apache#5 0x55795c7b57ab in std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>>::reserve(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/vector.tcc:79:22 apache#6 0x55795c7787f6 in doris::pipeline::OlapScanLocalState::_sync_cloud_tablets(doris::RuntimeState*) /root/doris/be/src/pipeline/exec/olap_scan_operator.cpp:466:20 apache#7 0x55795c777e7d in doris::pipeline::OlapScanLocalState::init(doris::RuntimeState*, doris::pipeline::LocalStateInfo&) /root/doris/be/src/pipeline/exec/olap_scan_operator.cpp:51:5 apache#8 0x55795b459bf9 in doris::pipeline::OperatorX<doris::pipeline::OlapScanLocalState>::setup_local_state(doris::RuntimeState*, doris::pipeline::LocalStateInfo&) /root/doris/be/src/pipeline/exec/operator.cpp:486:5 apache#9 0x55795d9c9a36 in doris::pipeline::PipelineTask::prepare(std::vector<doris::TScanRangeParams, std::allocator<doris::TScanRangeParams>> const&, int, doris::TDataSink const&) /root/doris/be/src/pipeline/pipeline_task.cpp:118:9
16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
==15185==ERROR: AddressSanitizer: heap-use-after-free on address 0x7da44ced96d0 at pc 0x55795dac5f46 bp 0x7bc26b9a3e50 sp 0x7bc26b9a3e48
READ of size 8 at 0x7da44ced96d0 thread T1357
#0 0x55795dac5f45 in std::_Function_base::_M_empty() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:249:37
#1 0x55795dac5f45 in std::function<doris::Status ()>::operator()() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:591:6
#2 0x55795dac5f45 in doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0::operator()() const /root/doris/be/src/cloud/cloud_meta_mgr.cpp:106:23
#3 0x55795dac5f45 in void std::_invoke_impl<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&>(std::_invoke_other, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:63:14
#4 0x55795dac5f45 in std::enable_if<is_invocable_r_v<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$0&>, void>::type std::_invoke_r<void, doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&>(doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:113:2
#5 0x55795dac5f45 in std::_Function_handler<void (), doris::cloud::bthread_fork_join(std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>> const&, int)::$_0>::_M_invoke(std::_Any_data const&) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:292:9
#6 0x55795da78d1d in std::function<void ()>::operator()() const /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:593:9
#7 0x55795da78d1d in doris::cloud::run_bthread_work(void*) /root/doris/be/src/cloud/cloud_meta_mgr.cpp:74:5
#8 0x55795f3da334 in bthread::TaskGroup::task_runner(long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x50a4e334)
#9 0x55795f3ccc80 in bthread_make_fcontext (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x50a40c80)
0x7da44ced96d0 is located 2640 bytes inside of 2688-byte region [0x7da44ced8c80,0x7da44ced9700)
freed by thread T1431 here:
#0 0x5579380e1f12 in operator delete(void*, unsigned long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x29755f12)
previously allocated by thread T795 (brpc_light) here:
#0 0x5579380e12ad in operator new(unsigned long) (/home/work/unlimit_teamcity/TeamCity/Agents/20250718121603agent_172.16.0.202_1/work/60183217f6ee2a9c/output/be/lib/doris_be+0x297552ad)
#1 0x55795c7b57ab in std::__new_allocator<std::function<doris::Status ()>>::allocate(unsigned long, void const*) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/new_allocator.h:151:27
#2 0x55795c7b57ab in std::allocator<std::function<doris::Status ()>>::allocate(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/allocator.h:203:32
#3 0x55795c7b57ab in std::allocator_traits<std::allocator<std::function<doris::Status ()>>>::allocate(std::allocator<std::function<doris::Status ()>>&, unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/alloc_traits.h:614:20
#4 0x55795c7b57ab in std::_Vector_base<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>>::_M_allocate(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_vector.h:387:20
#5 0x55795c7b57ab in std::vector<std::function<doris::Status ()>, std::allocator<std::function<doris::Status ()>>>::reserve(unsigned long) /usr/local/ldb-toolchain-v0.25/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/vector.tcc:79:22
#6 0x55795c7787f6 in doris::pipeline::OlapScanLocalState::_sync_cloud_tablets(doris::RuntimeState*) /root/doris/be/src/pipeline/exec/olap_scan_operator.cpp:466:20
#7 0x55795c777e7d in doris::pipeline::OlapScanLocalState::init(doris::RuntimeState*, doris::pipeline::LocalStateInfo&) /root/doris/be/src/pipeline/exec/olap_scan_operator.cpp:51:5
#8 0x55795b459bf9 in doris::pipeline::OperatorXdoris::pipeline::OlapScanLocalState::setup_local_state(doris::RuntimeState*, doris::pipeline::LocalStateInfo&) /root/doris/be/src/pipeline/exec/operator.cpp:486:5
#9 0x55795d9c9a36 in doris::pipeline::PipelineTask::prepare(std::vector<doris::TScanRangeParams, std::allocatordoris::TScanRangeParams> const&, int, doris::TDataSink const&) /root/doris/be/src/pipeline/pipeline_task.cpp:118:9
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)