Skip to content

fix(frontend): enforce max_execution_time - #27020

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:m-26678
Aug 17, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:m-26678

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #26678

What this PR does / why we need it:

fix(frontend): enforce max_execution_time

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mergify mergify Bot added the queued label Aug 17, 2026
@mergify

mergify Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-17 09:01 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-17 09:25 UTC · at 12430022643b52ce063d552aa0246b56fe3488cb

This pull request spent 23 minutes 46 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

Pull 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 4aab5da into matrixorigin:main Aug 17, 2026
25 of 26 checks passed
@mergify mergify Bot added dequeued and removed queued labels Aug 17, 2026
@iamlinjunhong
iamlinjunhong deleted the m-26678 branch August 23, 2026 17:13
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
XuPeng-SH added a commit that referenced this pull request Nov 29, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 29, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 29, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 29, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
Backport the session SELECT deadline from #27020 for #33378.
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
## 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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants