[BugFix] Unschedule global RF timer in PipelineDriver destructor (backport #76252)#76278
Closed
mergify[bot] wants to merge 1 commit into
Closed
[BugFix] Unschedule global RF timer in PipelineDriver destructor (backport #76252)#76278mergify[bot] wants to merge 1 commit into
mergify[bot] wants to merge 1 commit into
Conversation
) Signed-off-by: Jenwit Amonpongitsara <jenwit.amonpongitsara@agoda.com> (cherry picked from commit b0363d9) # Conflicts: # be/src/exec/pipeline/pipeline_driver.cpp # be/test/exec/pipeline/schedule/pipeline_timer_test.cpp
Contributor
Author
|
Cherry-pick of b0363d9 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Contributor
Author
|
@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr |
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.
Why I'm doing:
A BE/CN aborts during shutdown with
std::bad_weak_ptr:The global runtime-filter timer (
RFScanWaitTimeout) is owned solely byPipelineDriver::_global_rf_timer, and it is only unscheduled infinalize(). Queued or blocked drivers that are abandoned when the driverexecutor is closed at shutdown are destroyed without going through
finalize(), so the bthreadTimerThread— which keeps only a raw pointer tothe task — can still fire on a task whose last owning
shared_ptris alreadygone.
PipelineTimerTask::doRun()then callsshared_from_this()on the freedobject and throws
std::bad_weak_ptr, aborting the process.This is the abandoned-driver counterpart to the query-context-destruction race
fixed in #73082, which unscheduled only from
finalize(). The throwingshared_from_this()indoRun()was introduced whenPipelineTimerTaskbecame
enable_shared_from_thisin #72058.What I'm doing:
_unschedule_global_rf_timer()and call it fromboth
finalize()and~PipelineDriver().shared_ptrinto a local so the task stays alive acrossunschedule_and_join(), closing the window where a concurrently runningdoRun()could observe a zerouse_count.destructor blocks until an in-flight timer task returns.
Verified: both changed translation units compile cleanly with the project
toolchain (gcc-12,
-std=gnu++23), zero diagnostics.What type of PR is this:
Does this PR entail a change in behavior?
Checklist:
Bugfix cherry-pick branch check:
This is an automatic backport of pull request #76252 done by [Mergify](https://mergify.com).