Skip to content

[Bug] Chaos (33bc7a2): TPCC New-Order 1062 Duplicate entry on bmsql_oorder under task_mem_cn + 20502 (no co-timed 20638) #25784

Closed

Description

Environment

Field Value
Cluster mo-chaos-4-1-dev-33bc7a2-202607131556
Namespace mo-chaos-4-1-dev-33bc7a2-202607131556
MO version env name 33bc7a2; running image later observed as commit-b8cc25481 (S3 prefix still …/commit-33bc7a2/data)
Endpoint 10.222.6.253:6001
Artifact root /data1/chaos-test/29230227851_33bc7a2
Workloads TPCC (jTPCC), mo-load, vector/fulltext, chaos-mesh
Analysis window 2026-07-15 10:00 → 2026-07-16 10:16 CST
Incident 2026-07-15 19:39:17 CST (single ErrorCode : 1062 in that window)

Scope: One TPCC New-Order hit MySQL Error 1062 Duplicate entry on primary key (o_w_id, o_d_id, o_id) of bmsql_oorder during active task_mem_cn, ~2 minutes after a burst of 20502 backend connection closed. No co-timed 20638 txn commit status is unknown.

Out of scope / not claimed: TPCC durable consistency corruption. Window verify 2344 successfully / 0 failed; full soak 6599 / 0. This is PK collision / unsafe retry after connection loss under CN mem stress, not ytd/district drift.

Related but not identical: #25704 (2865ed6) — same surface (oorder 1062), different proximate chain (20638 + task_network_dn). Track as same symptom family, different trigger.

Summary

During chaos long-run on the 33bc7a2 env, the Jul-15 10:00+ analysis window logged exactly one 1062:

2026-07-15 19:39:17 FATAL jTPCCTerminal:327 - [UNEXPECTED][TT_NEW_ORDER][EXECUTION]
  ErrorCode : 1062,
  ErrorMessage : Duplicate entry '(8,3,23061)' for key '(o_w_id,o_d_id,o_id)'
Signal Value Interpretation
1062 (ErrorCode : 1062) in window 1 Rare
Co-timed 20638 (±2 min) 0 Not the #25704 same-second pattern
Preceding FATAL 20502 backend connection closed ×6+ at 19:37 (New-Order / Delivery) Connection/backend drop under CN mem stress
Chaos at fail task_mem_cn apply 19:35:40, delete 19:40:41 1062 mid mem-stress window
Prior chaos task_kill_dn 19:30:09–19:30:40; earlier task_kill_cn ended 19:25:09 DN recreate ~9 min earlier
Follow-on 19:40:15+ 1105 / getLockTableBind under same mem_cn Lock path stressed
TPCC consistency fail (window / soak) 0 / 0 No durable corruption gate failure

Preferred root-cause chain (symptom → mechanism → root):

  1. Symptom: New-Order INSERT into bmsql_oorder fails with 1062 on (8,3,23061).
  2. Mechanism: Under task_mem_cn, backends drop (20502). An in-flight or just-completed New-Order for o_id=23061 likely already allocated / committed the PK. Client (or reconnect path) starts another New-Order that reuses the same (w,d,o_id) without re-reading d_next_o_id → 1062.
  3. Root cause (fixable): Combination of
    • Client (jTPCC): after 20502 / reconnect, New-Order does not treat prior attempt as “must re-read d_next_o_id / probe existing PK before INSERT”; blind continuation reuses o_id.
    • MO (secondary): CN mem stress may amplify backend close / lock-bind latency (getLockTableBind right after), increasing ambiguous mid-txn outcomes even without 20638.
      Concurrent same-o_id allocation (lost/skipped lock on d_next_o_id) remains a hypothesis to rule out with MO traces for that district window.

Why not merge into #25704

#25704 This incident
Env 2865ed6 33bc7a2
PK (10,8,48585) (8,3,23061)
Co-timed 20638 Yes (same second) No
Chaos task_network_dn end +2s task_mem_cn mid-window (+ prior kill_dn)
Adjacent client error 20638 unknown commit 20502 backend connection closed

Same symptom class (New-Order oorder 1062 under chaos, consistency still green). Different proximate RCA — do not claim #25704 already covers this trigger.

Metric / log semantics

Signal Meaning
1062 on bmsql_oorder INSERT hit existing PK — that New-Order txn failed; does not by itself mean consistency verify failed
20502 backend connection closed Backend/RPC path torn down; retry without re-allocating o_id is unsafe
20638 Absent here — do not require unknown-commit resolve API to explain this event
Consistency verification successfully Cross-table invariants still hold — orthogonal to a single failed New-Order

Timeline (CST)

Time Event Evidence
19:25:09 task_kill_cn completed mo_chaos_test.log
19:30:09–19:30:40 task_kill_dn mo_chaos_test.log
19:35:40 task_mem_cn apply (mem-stress-cn) mo_chaos_test.log
19:37:06–19:37:22 20502 burst (New-Order / Delivery) tpcc.log
19:39:17 1062 on (8,3,23061) tpcc.log ~L190743
19:40:15–19:40:25 1105 / getLockTableBind tpcc.log
19:40:41 task_mem_cn completed mo_chaos_test.log
Continuous TPCC verify successfully (window 0 fail) check.log

Evidence

Log path

File Path
TPCC run log (1062) /data1/chaos-test/29230227851_33bc7a2/mo-chaos/test-tool/mo-tpcc/tpcc.log
Chaos harness /data1/chaos-test/29230227851_33bc7a2/mo-chaos/logs/mo_chaos_test.log
TPCC verify /data1/chaos-test/29230227851_33bc7a2/mo-chaos/test-tool/mo-tpcc/check.log

FATAL sequence (tpcc.log)

2026-07-15 19:37:06 FATAL ... [TT_NEW_ORDER] ErrorCode : 20502, backend connection closed
2026-07-15 19:37:16 FATAL ... [DELIVERY_BG]  ErrorCode : 20502, backend connection closed
2026-07-15 19:37:22 FATAL ... [TT_NEW_ORDER] ErrorCode : 20502, backend connection closed  (×5)
2026-07-15 19:39:17 FATAL ... [TT_NEW_ORDER] ErrorCode : 1062,  Duplicate entry '(8,3,23061)' for key '(o_w_id,o_d_id,o_id)'
2026-07-15 19:40:15 FATAL ... ErrorCode : 1105, context deadline exceeded / getLockTableBind

Chaos alignment (mo_chaos_test.log)

2026-07-15 19:30:09 ... Executing Chaos Task: task_kill_dn
2026-07-15 19:30:40 ... Task 'task_kill_dn' completed
2026-07-15 19:35:40 ... Success: stresschaos.../mem-stress-cn created
2026-07-15 19:40:41 ... Task 'task_mem_cn' completed

Consistency gate (not failed)

# check.log — analysis window Jul15 10:00+
Consistency verification successfully : 2344
Consistency verification failed      : 0
# full soak
successfully : 6599 / failed : 0

Why this is still worth an issue

  1. Broader than 20638: Safe New-Order retry must cover 20502 / reconnect / mem-stress, not only unknown-commit.
  2. Chaos realism: CN memory pressure is an expected product fault; PK-generating DML must not double-apply the same o_id.
  3. Sibling pattern: #25704 shows the same PK class under a different fault; together they argue for generic post-disconnect New-Order idempotency, not a one-off network_dn quirk.

Proposed fixes

A. Client / TPCC harness (primary for this incident)

Area Change
jTPCC New-Order On 20502 / lost connection / reconnect: do not re-INSERT with the same (w,d,o_id); (1) SELECT whether PK exists → treat as success, or (2) abort and re-read d_next_o_id in a new txn
Classification Treat 1062 after recent 20502/2013 under chaos as retry hazard, not corruption, unless consistency verify fails
JDBC Revisit autoReconnect=true mid-New-Order — reconnect can amplify wrong retry

B. MO server (secondary)

Area Change
CN under mem stress Reduce spurious backend connection closed / harden lock-table bind under stress
Observability Correlate New-Order o_id allocation with session disconnect for postmortem
Lock path getLockTableBind failures during mem_cn should not leave clients with stale allocated ids (if MO allocates server-side)

C. Verification

Check Expectation
Repro: task_mem_cn + TPCC New-Order soak 20502 may appear; 1062 rate → 0 after client fix
Soft gate Any 1062 on bmsql_oorder → attach adjacent error codes + chaos task; if consistency green → retry bug
Hard gate Still Consistency verification failed > 0 for durable corruption (separate)

Severity

P2 — rare (1 in ~24h window), no consistency verify failure; blocks safe-retry after disconnect hardening. Related to but not a duplicate of #25704.

Related

  • Sibling (20638 + network_dn): #25704 / issues/matrixone-chaos-2865ed6-tpcc-1062-duplicate-oorder.md
  • Same env historic 1062 (earlier soak days, including ol_* keys) — same family, out of this window’s single-event focus
  • Distinct from durable corruption: 07924fb / 18addf5 ytd fail class
  • Same env P1 (orthogonal): issues/matrixone-chaos-33bc7a2-dn-merge-missing-object-after-kill.md

Activity

  1. ghost added this to the MO-202607 milestone on Jul 16, 2026
  2. ghost added theissue type on Jul 16, 2026
  3. ghost added
    kind/bug
    on Jul 16, 2026
  4. ghost added
    severity/s0
    on Jul 16, 2026
  5. LeftHandCold commented on Jul 16, 2026

    @LeftHandCold
    Collaborator

    #25722 + #24906 可以修复这个问题

  6. LeftHandCold commented on Jul 16, 2026

    @LeftHandCold
    Collaborator
  7. ghost closed this as completedon Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugseverity/s0

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions