Skip to content

[Bug] CN FATAL exit: context deadline not set in txnOperator.validate during Delete → loadDatabaseFromStorage #26767

Closed

Description

Environment

Field Value
Cluster / namespace mo-stb-4-2-dev-fa6c57c-202608041202
Build / image matrixone:commit-c8dae1d45
Endpoint 10.222.6.255:6001
Artifact /data1/stability-test/30876385810_fa6c57c
CN pod stability-regression-dis-tp-cn-gndpr
Incident time 2026-08-07 09:31:26 CST / 01:31:26 UTC
Container exit Exit Code 1 (Last State: Terminated / Reason: Error)

Summary

On a long-run soak, CN process self-terminated after logging:

level=FATAL msg="context deadline not set"

Root path: a Delete pipeline reached Engine.loadDatabaseFromStorage / getOrCreateSnapPartBy, then txnOperator.validate found a context without deadline and called MOLogger.Fatal, killing the whole CN (not a recovered frontend panic).

Clients saw a short burst of 2013 / 20702 at the same second; TPCC consistency continued PASS after the pod restarted. This is still a process-killing defect: a missing deadline must not Fatal the CN.

Expected vs actual

Expected Actual
Missing / unset ctx deadline returns a normal error or uses a bounded internal ctx CN logs FATAL and exits (code 1)
Catalog/snap load failure stays on the SQL path Entire CN pod recycled; proxy routes fail briefly (no available CN / transfer failure)

Evidence

K8s

Last State:     Terminated
  Reason:       Error
  Exit Code:    1
  Started:      Thu, 06 Aug 2026 10:24:48 +0800
  Finished:     Fri, 07 Aug 2026 09:31:31 +0800
Restart Count:  2
Started (new):  Fri, 07 Aug 2026 09:31:32 +0800

CN log (FATAL)

time=2026/08/07 01:31:26.503720 +0000
level=FATAL
msg=context deadline not set
caller=log/logger.go:149

Immediately before FATAL (same second):

engine.database.load.from.storage name=repro_ivfflat_bug
compile.table-scan.txn schema=mo_catalog table=mo_database txn-snapshot-ts=0-0

Stack (abbreviated)

pkg/common/log.(*MOLogger).Fatal                         logger.go:149
pkg/txn/client.(*txnOperator).validate                   operator.go:1639
pkg/txn/client.(*txnOperator).Debug                      operator.go:1433
pkg/sql/plan/function/ctl.init.func1                     ctl/ctl.go:43
pkg/sql/plan/function/ctl.GetTNHandlerFunc               ctl/dist.go:88
pkg/vm/engine/disttae.init.func1                         disttae/db.go:482
pkg/vm/engine/disttae.(*Engine).getOrCreateSnapPartBy    disttae/db.go:506
pkg/vm/engine/disttae.(*txnTable).getPartitionState      txn_table.go:2588
pkg/vm/engine/disttae.(*txnTable).doRanges               txn_table.go:1104
pkg/vm/engine/disttae.(*txnTable).Ranges                 txn_table.go:707
pkg/sql/compile.(*Compile).expandRanges                  compile.go:6469
… ParallelRun / MergeRun / RemoteRun …
pkg/vm/engine/disttae.execReadSql                        util.go:739
pkg/vm/engine/disttae.(*Engine).loadDatabaseFromStorage  engine.go:358
pkg/vm/engine/disttae.(*Engine).Database                 engine.go:454
pkg/vm/engine/disttae.(*Transaction).getTable            txn.go:1452
pkg/vm/engine/disttae.(*Transaction).resolvePKCheckPosForWrite  txn.go:1487
pkg/vm/engine/disttae.(*Transaction).writeBatchWithAutoIncrEpochKnown  txn.go:331
pkg/vm/engine/disttae.(*txnTable).writeTnPartition       txn_table.go:2156
pkg/vm/engine/disttae.(*txnTable).Delete                 txn_table.go:2079
pkg/sql/colexec/deletion.(*Deletion).normalDelete        deletion.go:247
pkg/sql/colexec/deletion.(*Deletion).Call                deletion.go:91
… pipeline / Scope.Run / Compile.run …

Client (same second, CST)

2026-08-07 09:31:31  TPCC  Communications link failure (2013-class)
2026-08-07 09:31:33  TPCH  ERROR 2013 Lost connection during query
2026-08-07 09:31:44  TPCC  ErrorCode 20702 lock table bind changed

Proxy at 01:31:32 UTC: route failed / failed to connect to backend / no available CN-class transfer errors.

Mechanism

DML Delete (vector / account workload)
  → writeTnPartition / resolvePKCheckPosForWrite
  → Engine.Database → loadDatabaseFromStorage (catalog snap path)
  → getOrCreateSnapPartBy → ctl/TN debug validate
  → txnOperator.validate: ctx has no deadline
  → MOLogger.Fatal  ← process exit

Root cause

  1. Internal catalog/snap read during Delete uses a context (or txn debug/validate path) without a deadline.
  2. txnOperator.validate treats that as FATAL instead of returning an error to the SQL layer.
  3. Result: one bad ctx → entire CN death, not a single-statement failure.

Proposed fixes

MO (primary)

  1. pkg/txn/client/operator.go (validate ~1639): do not Fatal on missing deadline; return error / log ERROR.
  2. pkg/vm/engine/disttae (loadDatabaseFromStorage / execReadSql / getOrCreateSnapPartBy): ensure internal reads use a bounded context (or inherit statement deadline).
  3. Avoid calling txnOperator.Debug / ctl validate on hot Delete → catalog reload paths unless deadline is guaranteed.

Activity

  1. ghost added this to the MO-202608 milestone on Aug 7, 2026
  2. ghost added
    kind/bug
    on Aug 7, 2026
  3. ghost added theissue type on Aug 7, 2026
  4. changed the title [-]Bug] CN FATAL exit: `context deadline not set` in `txnOperator.validate` during Delete → loadDatabaseFromStorage[/-] [+][Bug] CN FATAL exit: `context deadline not set` in `txnOperator.validate` during Delete → loadDatabaseFromStorage[/+] on Aug 7, 2026
  5. assigned and unassigned on Aug 12, 2026
  6. Ariznawlll commented on Aug 17, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:4.2-dev
    • commit:aaac5956fdbcee0d43aed91c150fe3f2c05b90c1
    • 部署方式:7 Pod 分布式稳定性与 Chaos 环境(2 CN、1 DN、3 LogService、1 Proxy)
    • 稳定性 Namespace:mo-stb-4-2-dev-aaac595-202608142318
    • Chaos Namespace:mo-chaos-4-2-dev-aaac595-202608161347
    • 测试日期:2026-08-14 23:18 ~ 2026-08-17 14:05(CST)

    原问题验证

    当前 4.2-dev commit 已包含 #26894。对修复后的稳定性和 Chaos CN Pod 日志分别检查原错误签名:

    • context deadline not set:稳定性 0 次,Chaos 0 次
    • panic::稳定性 0 次,Chaos 0 次

    原问题中 Delete / catalog snapshot 路径因 context 无 deadline 调用 MOLogger.Fatal、导致 CN 进程退出的现象未复现。

    Happy Path 覆盖

    1. 4.2-dev 稳定性长稳负载持续运行,CN 未出现原错误签名或进程级 panic。
    2. Chaos TPCC 一致性检查累计成功 2,428 次,失败 0 次。
    3. 修复后正常事务、查询及一致性检查可以持续执行。

    Unhappy Path 覆盖

    1. Chaos task_kill_cn、task_kill_dn、CN/DN/LogService memory stress、CN/DN/LogService network chaos 均已重复执行至少 22 次;故障期间和恢复后均未出现 context deadline not set FATAL。
    2. 请求取消、连接中断和节点暂时不可用期间,CN 未因无 deadline context 退出,故障清理后 TPCC 一致性检查继续成功。
    3. 原 Delete cancellation 路径已由 fix(txn): preserve snapshot state on cancellation #26774/[4.2-dev] fix(txn): preserve snapshot state on cancellation #26894 的 focused regression 覆盖,修复将无 deadline 情况改为返回普通错误,不再终止 CN。

    白盒验证

    本轮为分布式长稳与 Chaos 黑盒复核,未额外执行白盒故障注入。#26774 已覆盖 transaction snapshot、statement context 传播及 canceled delete;#26894 将对应实现与回归测试回合到 4.2-dev。

    回归测试

    测试证据

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s-1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions