Repository navigation
fix(frontend): enforce max_execution_time - #27020
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 9be238d.
I traced the statement-scoped timeout through parse/planning, prepared execution, compile/pipeline context construction, distributed cancellation, transaction finalization, retry boundaries, response handling, and reusable process-context restoration. The timer is installed before logical/physical planning and pipeline construction, applies only to top-level client read-only SELECTs (including text/binary prepared SELECTs), and restores the parent context before the connection is reused. Query timeout is not classified as a whole-transaction failure, so explicit transactions retain ownership and roll back only the failed statement.
Validation on the exact head:
- focused frontend timeout tests under race, count=5
- real embedded-cluster issue regression (session scope, timeout error 3024/HY000, connection reuse, binary prepare, zero-disable)
- an additional adversarial transaction harness: BEGIN + INSERT, timed-out SELECT, verify the original uncommitted row remains visible only to that transaction, then ROLLBACK removes it
- error-code mapping and full diff/lifecycle audit
No blocking correctness, lifecycle, concurrency, or compatibility issue found.
Merge Queue Status
This pull request spent 23 minutes 46 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27020 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26678 ## What this PR does / why we need it: fix(frontend): enforce max_execution_time --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26678 ## What this PR does / why we need it: fix(frontend): enforce max_execution_time --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26678 ## What this PR does / why we need it: fix(frontend): enforce max_execution_time --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #33378. Backports #27020, which addressed #26678, to `4.2-dev`. ## What this PR does / why we need it: Honor session `max_execution_time` for read-only SELECT and both prepared protocols. Expiry returns MySQL 3024 (HY000) and the connection remains usable. Zero disables the statement limit. - Carry one deadline through transaction admission, binding, prepared metadata validation and execution. Scope CTE effects to their declarations and references. The bound plan owns the classification for reachable locks, external writes and opaque calls. Parsed locks or possible effects can defer the timer until classification. - Context-aware streams retain the provider’s normal concurrency. Finite ranges use a local slot for the disk-cache lookup and release it before remote fallback. Disk-cache lookups share one local admission key and use the origin when that key or the local pool is full. A cache-hit reader owns its buffer until close. - Local and blocking remote reads use separate process pools, each with twice the initial GOMAXPROCS and at most half for one source. Local reads use the lexical target path with its service root and object prefix where applicable. Configured and dynamic remote stores group by endpoint authority. Workers retain their slots through cleanup after cancellation. The caller merges private I/O statistics before its query context can be reused. - Read and close a timed PDF or DOCX before acquiring a converter. Input permits stay with their owner from fetch through conversion and cleanup. With initial GOMAXPROCS P, each process admits up to P+5 inputs and P conversions. Each I/O class reserves two inputs for distinct sources so a healthy source can fetch while another source stalls. Configured AWS services use their client’s S3 endpoint settings. Dynamic stages with an implicit endpoint resolve the service authority from the region. Both paths group by the S3 service authority before adding a bucket prefix. The limits count inputs and preserve existing document sizes. - Fetch WASM inputs before taking compiler capacity. A successful native ONNX handoff frees constructor capacity and lets the expression cache its session. An abandoned constructor holds its permit through destruction. Expression-owned sessions are destroyed after inference returns. - Cache reads follow the caller’s deadline in every test order. - Subscription statistics use the remaining statement deadline when reading publisher table metadata in the shared transaction. The lookup keeps its one-minute upper bound and system identity. Two stalled keys can fill a pool. Relative and absolute spellings, links, and mount aliases may have distinct lexical keys. A PDF or DOCX conversion can continue after its query returns and retains both permits until it finishes. ### Testing - A race-enabled MySQL TCP subscription probe delayed the publisher catalog lookup by three seconds. With a one-second setting, both `MO_TABLE_ROWS` and `MO_TABLE_SIZE` returned 3024/HY000 at about 1.002 seconds, down from 3.012 seconds. The same connection executed `SELECT 42`, and a zero limit let the lookup finish. Ordinary, prepared, locking, and admission controls passed in the same run. - The ONNX constructor permit test passed in coverage mode and in 100 race repetitions. A retained-permit control still failed. The owning function package passed under race with real ONNX Runtime inference and lifecycle tests. Incremental formatting, vet, molint, and golangci-lint passed across the 17 changed Go packages. - The AWS regional admission regression failed on `744bd3e37c` and passed under race at parallelism 1 and 4. At GOMAXPROCS=1, a MySQL TCP probe with local SDK transport returned the expected DOCX from us-west-2 in 4.7 ms while the us-east-1 request was stalled. The east request returned 3024/HY000 and its connection remained usable. SDK presigning verified the configured authority for profile regions, endpoint overrides, the China partition, FIPS, and dual stack. - MySQL TCP under race reproduced the document isolation failure with four HDFS reads stalled at GOMAXPROCS=4. A healthy local DOCX returned 3024 after about 701 ms at `999c0feedf` and returned the expected text in 2.8 ms at `744bd3e37c`, while all four HDFS reads were still stalled. Each stalled statement later returned 3024/HY000 and its connection executed `SELECT 42`. - Focused race tests cover input admission at one and four CPUs, canonical provider identity, cancellation during fetch, converter admission and conversion, and a DOCX over 64 MiB with the limit enabled and disabled. TCP tests also cover ordinary and SQL/binary prepared SELECTs, transaction admission, CTEs, locking reads and session reuse. - The local isolation regression passed by itself in normal and race runs at `GOMAXPROCS=1` and `4` on `75d8344018`. Its fixture supplies only the request context, file service, and SQL identity. Channel barriers verify that canceled readers retain admission, independent local files and DOCX documents remain readable, and all permits recover when I/O completes. Path tests cover raw, named, and dynamic disk targets, and cache fallback preserves range results. - On `4.2-dev@0e4db02`, the shuffled datalink and full fileservice suites and three selected MySQL TCP tests for #33378 and #32362 passed under race. Incremental gofmt, vet, molint, and golangci-lint passed across 17 Go packages with no new diagnostics. - Earlier race validation covered 16 affected packages and the maintained SQL BVT passed twice on one embedded instance (8/8 each). Pinned incremental SCA passed across all 17 affected Go packages at `4.2-dev@47e43f2`. - On the earlier document admission revision, five paired Linux/amd64 runs on one CPU gave median healthy timed DOCX latency of 143.9 µs before and 143.5 µs after. The input and handoff bookkeeping added 367 B and six allocations per timed read. The allocation count at a zero limit was unchanged. Earlier revisions also passed the scalar WASM, Starlark and jq BVT suites (17/17, 7/7 and 65/65) and the cache and provider isolation probes. --------- Signed-off-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #26678
What this PR does / why we need it:
fix(frontend): enforce max_execution_time