mrhhsg opened a new pull request, #66582:
URL: https://github.com/apache/doris/pull/66582
## What problem does this PR solve?
Issue Number: None
Problem Summary:
After a short query with runtime filters completes, the FE immediately
unregisters the Coordinator in `finalizeQuery()`, but the BE may still hold the
`QueryContext` alive via `_query_ctx_map_delay_delete` (inserted when runtime
filter merge controllers are non-empty). Since profile reporting
(`_report_query_profile`) is bound to `QueryContext` destructor, the final BE
profile RPC arrives after the Coordinator is already gone and is silently
dropped by `QeProcessorImpl.reportExecStatus()`, causing fragment-level profile
data to be lost.
**Root cause chain:**
1. BE: `_query_ctx_map_delay_delete` holds `shared_ptr<QueryContext>` after
all fragments finish, preventing `~QueryContext()` from running
2. Profile reporting (`_report_query_profile`) is only called in
`~QueryContext()`
3. FE: `finalizeQuery()` calls `updateProfile(true)` then immediately
`unregisterQuery()`, removing the Coordinator from `coordinatorMap`
4. BE's final profile RPC arrives after Coordinator is gone → silently
dropped
5. FE's pull-based realtime profile collection also fails because
`getCoordinator()` returns null
**Fix:**
Add a bounded wait in `finalizeQuery()` between `updateProfile(true)` and
`unregisterQuery()`. The wait:
- Reuses existing `profile_async_collect_expire_time_secs` config (default
5s) as timeout
- Polls `ExecutionProfile.isCompleted()` to detect when all backend profiles
have arrived
- Proceeds immediately once the profile data is confirmed complete
- Logs a warning if timeout is reached (profile may be incomplete, but we
must unregister to avoid Coordinator leak)
## Release note
None
## Check List (For Author)
- Test:
- Unit Test: N/A (FE profile collection timing, verified via regression
test)
- Regression test:
`regression-test/suites/query_profile_p0/test_profile_rf_delay.groovy` (passed
locally)
- Behavior changed: No (default wait of 5s already matches
`profile_async_collect_expire_time_secs`)
- Does this need documentation: No
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]