Mryange opened a new pull request, #71200: URL: https://github.com/apache/doris/pull/71200
### Background Doris pipeline workers take runnable tasks from a multilevel feedback queue. A dependency can resubmit a task before its current worker has finished handing it off. Queue placement uses accumulated task runtime, and workers charge elapsed time to a scheduling level. ### What problem does this PR solve? Issue Number: None Related PR: #55411 (split the schedulers and introduced the current accounting path) PR Type: Bugfix Problem Summary: ThreadSanitizer reported races in pipeline scheduling statistics when a task was queued again during a worker handoff. A worker now accounts for its execution before releasing ownership, using the level captured by its own dequeue, and the queue reads cumulative task runtime atomically. ### Details - **Frequency:** Intermittent during a task handoff. A dependency can requeue a task while the previous worker is finishing its execution. - **Root cause:** The previous worker read task metadata after clearing the running flag. Dequeue wrote the shared level before acquiring execution ownership, and enqueue could read task runtime concurrently with the previous worker's update. - **Why existing tests missed it:** PipelineTaskTest covers lifecycle, wakeup, and execution ownership, and the local shuffle regression tests check query results. Neither layer checks that two dequeues of the same task retain their respective queue levels. - **Fix:** Carry the chosen level with each dequeue, accumulate runtime with relaxed atomics, and update statistics before handing off execution ownership. - **Other paths and branches:** Local dequeue, timed dequeue, and work stealing share the new result type. Both HybridTaskScheduler worker pools use the same handoff. The patch cherry-picks cleanly onto branch-4.1 and branch-4.2. A cached branch-4.0 ref also shows the same release-before-accounting order. ### Testing ASAN BE unit tests passed on the development host (34 tests): `bash run-be-ut.sh --run --filter=PipelineTaskTest.*:PipelineTest.* -j32`. The new dequeue test verifies that an earlier dequeue retains its level after a steal and a resubmission at a different level. Historical ThreadSanitizer stacks and the baseline source establish the race. ThreadSanitizer was not rerun on the candidate. ### Notes for Reviewers The existing timer writes its elapsed value when it is destroyed, after the defer callback reads the value. This patch preserves the existing timer scope and worker-core attribution. ### Release note None ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Partially verified: focused ASAN BE unit tests passed, and the candidate has not been run under ThreadSanitizer. ### AI Disclosure - Tool: OpenAI Codex - Generated: Code, test updates, and PR description - Human review: The author reviewed the patch at a high level and approved submission. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
