Skip to content

[Bug]: Backport enforcement of max_execution_time to 4.2 #33378

Done

Description

@XuPeng-SH

Environment

MatrixOne v4.2.9, local single-node service and MySQL client. The main implementation is #27020, which addressed #26678. The current 4.2-dev tree has no corresponding statement timer implementation.

Actual behavior

The server accepts a positive session max_execution_time and reports it back. With the value set to 50 ms, a standalone SELECT SLEEP(0.3) returned normally after about 320 ms.

Expected behavior

A positive value times out an eligible client SELECT and returns a query-timeout error. A subsequent short query on the same connection succeeds. Zero retains its existing meaning.

Validation

Cover ordinary and prepared read-only SELECTs, SELECT timeout versus client cancellation, and reuse of the same session after timeout. This issue tracks honoring the existing session setting; administrator-enforced ceilings are a separate contract.

Activity

  1. added
    kind/bug
    on Nov 27, 2026
  2. added
    severity/s0
    and removed on Nov 27, 2026
  3. XuPeng-SH commented on Nov 30, 2026

    @XuPeng-SH
    ContributorAuthor

    补充 4.2-dev 合入后的转测证据:PR #33388 的合并 SHA 95679da6cf5bc20780f510e151acea67b7fae08c 与 CI 实际检出的 75d83440185387df56b54c8f4799cb6fdf2f4db9 源码树一致(a3baf1f42df268606e69ec876d67b8d7123007b8)。

    • 实际多 CN 悲观模式 BVT 的 system_variable/max_execution_time.sql 执行 8 条、全部通过、无跳过。覆盖普通 SELECT 的超时、短查询复用同一会话、零值禁用。
    • 实际 Ubuntu UT 日志 的 TestIssue33378MaxExecutionTime 和 TestIssue33378MaxExecutionTimeWhileWaitingForTxnAdmission 通过;普通查询、binary prepared SELECT、事务内 SQL prepared SELECT、客户端 KILL QUERY、零值及会话隔离均有明确通过记录。

    本轮核对的是上述实跑日志,没有重跑旧版或生产环境。继续由现有 QA 负责人复核,不改派;不把这次交接当最终验收。

  4. Ariznawlll commented on Dec 1, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • MatrixOne 官方 4.2-dev@d497cc15841051c49e221e28457e261e86fdb7d9。
    • 精确源码及 binary SHA-256 087647f1e059b3f73a5fc63ccfda7d466309e4b6a22621968e85205f117e98d1;验收开始和结束时官方 4.2-dev SHA 均为上述提交。
    • 全新独立双 CN 运行时,两个 SQL 入口的 git_version() 均逐字等于上述完整 SHA。

    原问题验证

    按 Issue 原始边界设置 session max_execution_time=50,执行 SELECT SLEEP(0.3):

    1. 普通 SELECT 返回错误 3024 / HY000,六轮实测约 50.4–51.0 ms,随后同一连接 SELECT 42 成功且 connection_id() 不变。
    2. binary prepared SELECT SLEEP(0.3) 同样返回 3024 / HY000;prepared SELECT SLEEP(0) 成功,随后仍复用同一连接。
    3. SQL prepared SELECT SLEEP(0.3) 同样超时;随后 SELECT 7 成功且连接不变。
    4. 两个 CN 各 3 轮,共 6/6 PASS,不是只执行一次健康控制。

    Happy / Unhappy Path 与白盒覆盖

    • max_execution_time=0 时 SELECT SLEEP(0.1) 正常返回 0;新连接仍看到会话默认值 0,确认设置 session scoped。
    • KILL QUERY 中断长查询返回非超时的 1105 / context canceled,不是 3024;随后同一连接 SELECT 9 成功且连接不变。
    • TestIssue33378MaxExecutionTime 与 TestIssue33378MaxExecutionTimeWhileWaitingForTxnAdmission 在当前精确 4.2 源码以 -race -count=3 执行,两个 root 合计 6/6 PASS,无 FAIL、SKIP 或 DATA RACE。

    早期探针中的 SET helper、session variable 字符串类型比较属于夹具错误;另一次浮点 bind 引入的是原 Issue 之外的 SLEEP(?) cast 前提,均未计作产品失败或 PASS。最终交付脚本使用原始语义的 literal 0.3 binary prepared 场景完整重跑,上述 6/6 均来自最终脚本。

    独立 MOTR 回归

    按今天重新独立交付的要求,没有叠加旧 PR 353;从最新 MOTR 4.2-dev 新建:

    结论

    原 50ms 普通/prepared SELECT 超时、客户端取消区分、零值及同会话复用均已通过,回归已独立交付,关闭本 Issue。

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions