Repository navigation
Description
Environment
| Field | Value |
|---|---|
| Cluster | mo-stb-58ad528-202605251910 |
| Namespace | mo-stb-58ad528-202605251910 |
| Build / image | matrixone:commit-b0544ba46 (3.0-dev) |
| Endpoint | 10.222.6.254:6001 |
| Artifact root | /data1/stability-test/26397420405_58ad528 |
| Workloads | sysbench-1 (mo-load), dml-vector (ivf_dml_scenarios.py), fulltext, TPCH, TPCC |
| Analysis window | 2026-06-01 12:00 CST → 2026-06-02 ~10:00 CST (~22h) |
Scope: MatrixOne CN txn leak-check reports found leak txn after CN restart — server retains txn handles for ~9.5 hours without rollback when client TCP sessions die mid-flight.
Out of scope: wait-active txn scheduler stall (was 0 throughout); fulltext/qvec workload SQL correctness.
Summary
During stability soak, Loki reports 570 found leak txn lines on CN pods in the window 2026-06-01 12:00 CST → 2026-06-02 ~10:00 CST.
Critical correction: 570 ≠ 570 leaked transactions. Parsing all Loki lines shows only 10 unique txn-id values, each logged 57 times (leak-check runs every ~10 minutes). Actual leak count: 10 orphaned txns.
| Account | Leaked txns | Mode |
|---|---|---|
| sysbench_test1 | 8 | autocommit:true; JDBC handshake only (no DML) |
| vector_test | 2 | Explicit txn: SET AUTOCOMMIT=0 + SELECT … LIMIT 1; no DELETE/COMMIT/ROLLBACK |
| fulltext_vector_test | 0 | Not observed in this window |
Root cause: After tp-cn-qsgzx CN restart (2026-06-01 14:53 CST), client connections from proxy 10.10.187.65 were dropped while MO had already created txn handles. MO did not rollback/cleanup those txns on session disconnect — they persisted until the next CN roll (2026-06-02 00:39 CST), when TPCC hit mass Communications link failure.
Prometheus in the same window: wait-active=0, commit 102–394/s — this is session-level txn handle leak, not txn scheduler failure.
Metric / log semantics
| Signal | Value (window) | Interpretation |
|---|---|---|
Loki found leak txn lines |
570 | 10 unique txns × 57 leak-check rounds |
Loki unique txn-id |
10 | True leak count |
mo_txn_queue_size{type="wait-active"} |
0 (max) | No txn-create stall |
rate(mo_txn_commit_total{type="cn"}) |
min 102/s, max 394/s | Commit path healthy |
mo_txn_queue_size{type="lock-rpc"} |
max 25 | Minor; unlike 58c90b8 lock-rpc storm |
Timeline (CST, cross-layer)
| Time | Event | Evidence |
|---|---|---|
| 06-01 14:53 | tp-cn-qsgzx CN restart |
Pod startTime=2026-06-01T06:53:59Z |
| 06-01 14:57–14:58 | 10 txns created, then orphaned | create-at in leak logs: 06:57:49 / 06:58:00–06:58:01 UTC |
| 06-01 15:25–00:35 | Leak-check repeats same 10 txn-ids every ~10min | Loki dump buckets: 15:25, 15:35, … 00:35 UTC (57 rounds) |
| 06-01 19:54 | TPCC 1105 connection reset to qsgzx CN |
tpcc.log |
| 06-02 00:38–00:39 | TPCC mass Communications link failure → session end |
tpcc.log; qsgzx lastTerm=2026-06-01T16:39:54Z |
Evidence
Loki — leak txn sample (tp-cn-qsgzx, previous container)
{"level":"ERROR","time":"2026/06/01 16:35:30.383244 +0000","caller":"cn-service",
"msg":"found leak txn",
"txn-id":"79083e552366150118b4e28b6f136df0",
"create-at":"2026/06/01 06:58:00.514069 +0000",
"options":"... ConnectionID:7188385 ... account sysbench_test1:admin ... autocommit:true ...",
"profile":"ETL:/profile/CN_..._leakcheck_routine_....gz"}Aggregate (Loki, Jun1 12:00 CST → Jun2 ~10:00 CST):
| Pattern | Count | Notes |
|---|---|---|
found leak txn (all lines) |
570 | 10 txn-id × 57 rounds |
Unique txn-id |
10 | — |
sysbench_test1 |
456 lines (8 txns) | All autocommit:true |
vector_test |
114 lines (2 txns) | No autocommit:true flag → explicit txn |
wait active |
0 | — |
unsupported value: +Inf |
0 | Improved vs earlier 5/29 window |
system.statement_info — concrete SQL per leaked connection
Type A — vector_test (2 txns, explicit transaction leak)
Connection 7188364 / 7188367 — create-at 2026-06-01 14:57:49 CST
SET NAMES utf8mb4;
SET AUTOCOMMIT = 0;
SELECT id FROM test_vectors
WHERE user_id = 'user_mutable' AND is_active = 1
LIMIT 1;
-- Expected next: DELETE FROM test_vectors WHERE id = ?
-- Actual: no DELETE, COMMIT, or ROLLBACK on this connectionWorkload source: ivf_dml_scenarios.py → deleter_loop() (dml-vector-test).
Type B — sysbench_test1 (8 txns, autocommit session orphan)
Connections 7188379–7188387 — create-at 2026-06-01 14:58:00–14:58:01 CST
/* mysql-connector-java-8.0.19 */ SELECT @@session.auto_increment_increment AS auto_increment_increment, ...;
SET NAMES utf8mb4;
SET character_set_results = NULL;
-- No UPDATE/DELETE/INSERT; no COMMITContext: 36+ sysbench connections opened in 06:58:00–06:58:05 with only Select/Set Var — JDBC reconnect storm after CN roll.
Pod lifecycle
stability-regression-dis-tp-cn-qsgzx
startTime: 2026-06-01T06:53:59Z (14:53 CST roll)
lastTerm: 2026-06-01T16:39:54Z (00:39 CST next roll)
restartCount: 1 (current pod)
Root cause
Mechanism
CN qsgzx restart (14:53 CST)
↓
sysbench JDBC reconnect storm + vector deleter concurrent sessions
↓
MO creates txn handles on session (even for handshake / mid-deleter SELECT)
↓
TCP/proxy disconnect (client killed or CN roll side-effect)
↓
MO session ends WITHOUT rollback/cleanup of txn handle ← defect
↓
10 txns linger ~9.5h; leakcheck logs each every 10min (570 lines)
↓
00:39 CN roll → downstream Communications link failures (TPCC)
Why this is a MatrixOne bug (not client-only)
| Observation | Implication |
|---|---|
autocommit:true txns leak after only SET NAMES / SELECT @@… |
Not "client forgot COMMIT" — MO created a txn handle that outlived the TCP session |
| Txns survive ~9.5h until next CN roll | No server-side TTL / disconnect cleanup |
wait-active=0 + healthy commit |
Not txn scheduler bug; session cleanup bug |
| MySQL-compatible expectation | Connection abort → server must rollback uncommitted work |
Client contributing factors (secondary)
| Component | Behavior | Mitigation (already tracked separately) |
|---|---|---|
ivf_dml_scenarios.py deleter_loop |
SELECT then DELETE in explicit txn; disconnect mid-flight |
Client reconnect + rollback (fixed locally in mo-nightly-regression) |
| mo-load sysbench | Connection pool opens many JDBC sessions after CN roll | Purge stale pool connections on 20101/reset |
These reduce trigger rate but do not replace MO disconnect rollback.
Expected vs actual
| Expected | Actual |
|---|---|
| Client disconnect → server rollback txn | 10 txns persist ~9.5h |
JDBC handshake under autocommit:true → no orphan txn handle |
8 sysbench txns leak after SET NAMES only |
| Leak-check log count ≈ distinct leaks | 570 lines for 10 txns (misleading without dedup) |
Soak: found leak txn unique count = 0 after CN recovery |
10 unique txn-id from 14:57 until 00:39 roll |
Proposed fixes
P0 — MO server: rollback on session disconnect
| Path (expected) | Change |
|---|---|
pkg/frontend/ session / Routine cleanup |
On Close() / Kill() / read EOF: if txn active → Rollback() + release locks/workspace |
pkg/frontend/mysql_protocol.go (or equivalent disconnect handler) |
Ensure proxy/client TCP reset triggers same cleanup path as graceful quit |
Verify: Kill client mid-session → found leak txn 0 within one leak-check period; mo_txn_queue_size{type="active"} does not retain stale entries.
P0 — MO server: defer txn creation for autocommit handshake
| Path (expected) | Change |
|---|---|
| Session / txn init on first DML | SET NAMES, SELECT @@session.* under autocommit:true must not allocate a long-lived txn handle |
Verify: Open JDBC connection, run handshake only, kill client → leak-check 0.
P1 — MO observability: leak-check dedup
| Path | Change |
|---|---|
pkg/cnservice/server.go leakcheck_routine |
Log distinct leak count=N once per scan; suppress repeat lines for same txn-id (or log at WARN once + DEBUG repeat) |
Verify: 10 hanging txns → 10 log lines per scan, not 570/hour.
P1 — Client / workflow (reduce trigger rate)
| Component | Fix |
|---|---|
ivf_dml_scenarios.py |
deleter_loop: rollback + reconnect on error (done in local mo-nightly-regression patch) |
| mo-load sysbench | On CN unavailability: invalidate connection pool; avoid reconnect storm |
P2 — Deploy
- Fix upstream CN OOM/+Inf to reduce roll frequency (see 58ad528 stability report); fewer rolls → fewer disconnect triggers.
Reproduce
- Deploy stability cluster
commit-b0544ba46/ namespacemo-stb-58ad528-202605251910. - Run sysbench-1 + dml-vector (
ivf_dml_scenarios.py --scenario all) against10.222.6.254:6001. kubectl delete podone CN pod (or wait for OOM roll).- Within ~5 minutes, confirm clients reconnect (sysbench JDBC + vector deleter).
- Wait ≥30 minutes; query Loki:
{namespace="mo-stb-58ad528-202605251910", pod=~"tp-cn.*"} |= "found leak txn" - Correlate with
system.statement_info:SELECT connection_id, request_at, statement_type, LEFT(statement, 120) FROM system.statement_info WHERE account IN ('sysbench_test1', 'vector_test') AND request_at >= '<roll_time>' ORDER BY connection_id, request_at;
- Expect (bug): leak lines appear; connections show handshake-only (sysbench) or
AUTOCOMMIT=0+SELECTwithoutDELETE/COMMIT(vector).
Activity
LeftHandCold commentedon Jul 7, 2026
fixed as #25447
LeftHandCold commentedon Aug 6, 2026
Root-cause correction for the fa6c57c recurrence
The 2026-08-05 recurrence in the latest comment is definitively a lockservice
deadlock. It is not evidence that frontend disconnect cleanup skipped Rollback.
Production proof
On CN d7vgf, two goroutine profiles captured about five hours apart retain the
same two opposing wait chains:
Unknown-commit cleanup:
unknownCommitResolver.resolvePending
-> service.unlockUnknownCommit
-> activeTxnHolder.deleteActiveTxn
-> activeTxnShard.Lock
unlockUnknownCommit acquired activeTxn.Lock first and still held it while
waiting for the holder shard write lock.
Stale-bind cleanup:
handleKeepBindFailed
-> removeLockTablesWithFence
-> mapBasedTxnHolder.fenceByBindChanged
-> activeTxn.fenceByBindChanged
-> activeTxn.Lock
fenceByBindChanged retained activeTxnShard.RLock while waiting for the
transaction lock.
The resulting cycle is exact:
The same goroutines and stack states persisted from 13:30 UTC to 18:31 UTC, so
this is not a transient slow RPC. The stale-bind path also retained
bindChangeMu.Lock. Consequently new service.Lock calls accumulated behind
bindChangeMu.RLock: 151 blocked requests in the first profile and 1193 in the
second. Those still-live SQL requests retained transaction operators, explaining
the active gauge near 1280 and the repeated found leak txn reports. Killing the
CN removed the deadlocked process and cleared both active and wait-active.
The incident begins after the two unknown Commit outcomes around 13:09:04 UTC
and stale local binds are removed around 13:09:35 UTC, matching the two sides of
the reproduced lock cycle.
Code provenance
registered until owner unlock is acknowledged.
formed the shard/transaction lock-order inversion shown above.
Fix
PR #26749 removes the blocking shard-to-transaction edge. It snapshots keys,
uses TryLock while shard.RLock protects the pooled transaction pointer, and
releases the shard before retrying a busy transaction. Unknown cleanup can then
delete the transaction and terminate; uncontended fencing preserves the existing
behavior.
The deterministic regression times out on pre-fix main with the same opposing
stacks and passes after the change. Focused race ran 100 times, and the complete
pkg/lockservice package passed in normal and race modes.
Scope note: the original b0544ba incident predates #24906/#25722/#25823 and
cannot be attributed to this lock inversion. #26749 therefore relates to this
issue but intentionally does not auto-close the older, separately asserted
disconnect-cleanup case.
Ariznawlll commentedon Aug 17, 2026
main 稳定性复现情况更新
mainf9af0064116f885ce68b0db4d94d4fafdc9bafc3commit-f9af006mo-stb-main-f9af006-202608142315检查两个 CN 的完整日志窗口:
found leak txnstability-regression-dis-tp-cn-4768qstability-regression-dis-tp-cn-tr9t5两个 CN 在检查结束时仍持续产生业务日志。
结论:截至当前,main 稳定性测试没有继续复现 #24766。