-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[fix](be) Avoid finalized pipeline task submit crash #64899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -322,6 +322,11 @@ bool PipelineTask::is_blockable() const { | |
| _sink->is_blockable(_state); | ||
| } | ||
|
|
||
| void PipelineTask::_stop_accepting_submit() { | ||
| std::unique_lock<std::mutex> lock(_blockable_check_lock); | ||
| _accept_submit = false; | ||
| } | ||
|
|
||
| bool PipelineTask::_is_blocked() { | ||
| // `_dry_run = true` means we do not need data from source operator. | ||
| if (!_dry_run) { | ||
|
|
@@ -887,6 +892,7 @@ Status PipelineTask::finalize() { | |
| return Status::OK(); | ||
| } | ||
| SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(fragment->get_query_ctx()->query_mem_tracker()); | ||
| _stop_accepting_submit(); | ||
| // Synchronize with unblock_all_dependencies() before clearing state used by wake_up()->submit(). | ||
| std::unique_lock<std::mutex> lock(_dependency_lifecycle_lock); | ||
| RETURN_IF_ERROR(_state_transition(State::FINALIZED)); | ||
|
|
@@ -901,6 +907,9 @@ Status PipelineTask::finalize() { | |
| } | ||
|
|
||
| Status PipelineTask::close(Status exec_status, bool close_sink) { | ||
| if (close_sink) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在finalize 里加了之后,这里为什么还要加?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. op->close / sink->close 这些东西本质也是写操作,担心会让is blockable这个读操作不安全。而且理论上进close sink了也不需要再submit了 不过实际执行逻辑是 [close_task] -> [task->close] -> [task->finalize] 。可以只在close sink里加,finalize里不加 |
||
| _stop_accepting_submit(); | ||
| } | ||
| int64_t close_ns = 0; | ||
| Status s; | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我们调用这个is block 方法的时候,一定有整个fragment context 的shared ptr,为啥会出现析构的问题?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is blockable里调的是sink operator这些东西,PipelineTask在finalize/close里会释放相关资源