You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/03/12 14:52:29 UTC
(doris) 02/04: [bugfix](becore) has to use value to capture lambda value to avoid core during callback (#32132)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 5da7cd0fba270f166874b4284cda79abe6b547db
Author: yiguolei <67...@qq.com>
AuthorDate: Tue Mar 12 21:17:07 2024 +0800
[bugfix](becore) has to use value to capture lambda value to avoid core during callback (#32132)
Co-authored-by: yiguolei <yi...@gmail.com>
---
be/src/vec/sink/writer/vtablet_writer.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/be/src/vec/sink/writer/vtablet_writer.cpp b/be/src/vec/sink/writer/vtablet_writer.cpp
index bfac8e2e7a9..042f736861f 100644
--- a/be/src/vec/sink/writer/vtablet_writer.cpp
+++ b/be/src/vec/sink/writer/vtablet_writer.cpp
@@ -357,9 +357,10 @@ Status VNodeChannel::init(RuntimeState* state) {
_cur_add_block_request->set_eos(false);
// add block closure
+ // Has to using value to capture _task_exec_ctx because tablet writer may destroyed during callback.
_send_block_callback = WriteBlockCallback<PTabletWriterAddBlockResult>::create_shared();
- _send_block_callback->addFailedHandler([this](bool is_last_rpc) {
- auto ctx_lock = _task_exec_ctx.lock();
+ _send_block_callback->addFailedHandler([&, task_exec_ctx = _task_exec_ctx](bool is_last_rpc) {
+ auto ctx_lock = task_exec_ctx.lock();
if (ctx_lock == nullptr) {
return;
}
@@ -367,8 +368,9 @@ Status VNodeChannel::init(RuntimeState* state) {
});
_send_block_callback->addSuccessHandler(
- [this](const PTabletWriterAddBlockResult& result, bool is_last_rpc) {
- auto ctx_lock = _task_exec_ctx.lock();
+ [&, task_exec_ctx = _task_exec_ctx](const PTabletWriterAddBlockResult& result,
+ bool is_last_rpc) {
+ auto ctx_lock = task_exec_ctx.lock();
if (ctx_lock == nullptr) {
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org