[fix](pipeline) Avoid to close task twice (#36747) (#37115)

This commit is contained in:
Gabriel
2024-07-04 10:02:56 +08:00
committed by GitHub
parent 26be313d40
commit 4532ba990a
3 changed files with 7 additions and 1 deletions

View File

@ -242,6 +242,8 @@ public:
}
}
virtual bool is_finished() const { return false; }
virtual void set_close_pipeline_time() {
if (!_is_close_pipeline) {
_close_pipeline_time = _pipeline_task_watcher.elapsed_time();

View File

@ -88,7 +88,7 @@ public:
void finalize() override;
bool is_finished() const { return _finished.load(); }
bool is_finished() const override { return _finished.load(); }
std::string debug_string() override;

View File

@ -231,6 +231,10 @@ void _close_task(PipelineTask* task, PipelineTaskState state, Status exec_status
// Should count the memory to the query or the query's memory will not decrease when part of
// task finished.
SCOPED_ATTACH_TASK(task->runtime_state());
if (task->is_finished()) {
task->set_running(false);
return;
}
// close_a_pipeline may delete fragment context and will core in some defer
// code, because the defer code will access fragment context it self.
auto lock_for_context = task->fragment_context()->shared_from_this();