lihongjie0209 opened a new pull request, #70318: URL: https://github.com/apache/doris/pull/70318
### Background `SHOW QUERY STATS` merges local query hit counts with counts from other live Frontends. `QueryStatsUtil.getStats()` calls each peer through a pooled FE Thrift client. ### What problem does this PR solve? Issue Number: close #70317 Related PR: None PR Type: Bugfix Problem Summary: Every remote query stats call borrows a client without returning it, so repeated requests accumulate FE-to-FE connections and can exhaust peer Thrift workers. Return clients after completed RPCs, including skipped responses, and invalidate clients when the RPC fails. Existing query stats results are unchanged. ### Details - **Frequency:** Every query stats request that contacts a peer FE. - **Root cause:** `QueryStatsUtil.getStats()` borrows from `ClientPool.frontendPool` but has no matching `returnObject` or `invalidateObject` call. - **Why existing tests missed it:** Query stats tests did not verify the pooled FE client's lifecycle. - **Fix:** Use a `finally` block to return a client after a completed RPC or invalidate it after an RPC exception. - **Other paths and branches:** The fix covers all query stats types handled by `getStats()`, including status checks and empty results. The same leak is present in the 2.1.8 family; a backport may be appropriate. ### Testing - Added FE unit tests for successful response, empty response, non-OK status, and RPC failure. The success and skipped-result cases verify `returnObject`; the failure case verifies `invalidateObject`. These tests would fail before the fix. - `git diff --check` passed locally. - FE unit tests were not run locally because this sparse checkout lacks the required `thirdparty/installed/bin/protoc`; CI should run them. ### Release note Repeated `SHOW QUERY STATS` requests no longer accumulate FE-to-FE Thrift connections. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: FE unit tests await CI because `protoc` is missing locally. ### AI Disclosure - Tool: OpenAI Codex (GPT-6). - Generated: The fix, FE unit tests, and PR description. - Human review: Pending maintainer review. -- 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]
