[BugFix] Stop a PPL query at its timeout and report it as one #5933
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 319 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5933"
general
weight: 0.35
Swiddis
Description
A PPL query that hits
plugins.ppl.query.timeouthas two problems today:RuntimeException, so a client can't tell a deadline from a backend failure, and the request is counted as a plugin system fault.This change makes the deadline actually stop the query, and report itself.
Stopping the query. The timeout now cancels the query's task instead of only interrupting the thread.
OpenSearchIndexEnumerator#moveNextalready checksCancellableTask#isCancelled()on every row, so cancelling gives a busy query a checkpoint. The interrupt is kept, since that is what frees a thread already blocked on a fetch.Reporting it. The timeout now raises a
QueryTimeoutException, which answersREQUEST_TIMEOUT. A deadline is not a gateway timeout:RestClientmarks the node dead and retries on 502, 503 and 504, and opensearch-py retries the same three by default, so a 504 would get the query resent — the opposite of what a deadline is for. The subclass also separates a query exceeding its own deadline from anactionGet(timeout)failing to answer, which is a backend fault.ThreadPoolExecutionDispatcherpreviously had no timeout detection on either of its paths, so neither reported one.Counting it. 408 falls in the existing 4xx branch, so a deadline is counted as a caller outcome with no special case in the metric.
Related Issues
Resolves #5932
Related: #5934 binds the task for queries sent by other plugins, which this change needs in order to help them.
Check List
--signoff.Tests
OpenSearchQueryManagerTest— the expired deadline surfaces as a 504 timeout, an unrelated failure is untouched, andexpirecancels and interrupts.SyncErrorReportRendererTest— a timeout is recognised through the wrapper chain; an ordinary failure is not.PPLQueryTimeoutIT— both execution paths time out with 504, and a query inside its deadline still succeeds.I left some implementation notes in a comment below.