Skip to content

[Bug]: MO CN errors on plan JSON +Inf #24520

Closed

Description

Stability sysbench-2 (177ed31): MO CN errors on plan JSON +Inf and drops sysbench_test2 connections ~2h into long-run

Affected workload only

Field Value
Workload sysbench-longrunning-test-2 / mo-load
Case cases/sysbench/mixed_10_100000/ (point_select, delete_insert, update_pk; 25 threads each)
Command ./start.sh -h 10.222.6.254 -P 6001 -u sysbench_test2:admin -p 111 -c cases/sysbench/mixed_10_100000/ -t 25 -d 60000 -g -b sbtest
MO account / DB sysbench_test2:admin / sbtest
Artifact log /data1/stability-test/25979912201_177ed31/sysbench-longrunning-test-2/mo-load/log/test.log
Cluster mo-stb-177ed31-202605171112, build 177ed31, endpoint 10.222.6.254:6001

Scope of this issue: MatrixOne server behavior that caused sysbench-2 to lose database service at 2026-05-17 13:35 CST (~2h15m after start at 11:20).
Out of scope: mo-load client exit policy (-d, con_mode, ResultProcessor) — separate client issue.

Summary

Sysbench-2 long-run was healthy until ~13:34; then all 75 JDBC sessions (25×3 transactions) stalled and at 13:35:49 reported Communications link failure with ~100s since last packet (JDBC socketTimeout=100000). MO had already logged serialize plan to json error: json: unsupported value: +Inf on CN and proxy close connection failed in the same window.

MatrixOne defect: optimizer stats can produce +Inf selectivity, plan JSON marshal fails on CN, connections to sysbench_test2 are dropped — sysbench-2 could not continue the long-run on the server side.

Timeline (sysbench-2, CST)

Time sysbench-2 (test.log) MatrixOne (Loki / cluster)
11:20:05 Start; The test will last for 60000 minutes MO up after setup
11:20–13:34 Normal TPS (mixed OLTP) —
13:35:09+ tps=0 (no new successful txns) CN/proxy degradation
13:35:49 Mass Communications link failure, RequestTime 13:34:09 Aligns with ~100s socket timeout
13:35:49 — CN: +Inf plan JSON error (same window)
13:36+ MOConnection: Attempted reconnect 4 times. Giving up to 254:6001/sbtest MO still refusing/unhealthy for test2

After this point sysbench-2 never recovered TPS until manual restart (2026-05-21).
(CN OOMKilled at 23:50 same day is a later event; not the immediate trigger at 13:35 for sysbench-2.)

Evidence (sysbench-2)

Client — test.log

2026-05-17 11:20:05 INFO  MOPerfTest:82 - username = sysbench_test2:admin
2026-05-17 11:20:05 INFO  MOPerfTest:110 - The test will last for 60000 minutes.
...
2026-05-17 13:35:49 ERROR TransExecutor - Communications link failure
The last packet successfully received from the server was 100,094 milliseconds ago.
2026-05-17 13:36:01 ERROR MOConnection - Could not create connection to database server.
Attempted reconnect 4 times. Giving up.
jdbc:mysql://10.222.6.254:6001/sbtest?...&socketTimeout=100000&...
username=sysbench_test2:admin

Counters frozen after incident (example at 13:36): point_select suc=368551, delete_insert suc=190393, update_pk suc=269266 — no further progress while MO unavailable.

Server — Loki (mo-stb-177ed31-202605171112, ~13:30–14:00 CST)

serialize plan to json error: json: unsupported value: +Inf

Proxy: close connection failed (same period).

Root cause (MatrixOne)

1. +Inf in plan statistics → CN statement/path failure

pkg/sql/plan/stats.go uses unchecked division, e.g. when Cost == 0 or TableCnt == 0:

node.Stats.Selectivity = node.Stats.Outcnt / node.Stats.Cost      // lines ~1365, 1378, 1388, 1401
scanNode.Stats.Selectivity = scanNode.Stats.Outcnt / scanNode.Stats.TableCnt  // ~1560
stats.Selectivity = stats.Outcnt / stats.TableCnt                 // ~1680

pkg/frontend/mysql_cmd_executor.go (~4096):

err = encoder.Encode(h.marshalPlan)
// → moerr: serialize plan to json error: json: unsupported value: +Inf

Under sysbench mixed load (SELECT / UPDATE / DELETE+INSERT on sbtest*), some plans hit this path; CN returns error and the session breaks.

2. Connection drop to sysbench-2 sessions

Failed CN handling + proxy teardown → existing sysbench_test2 TCP sessions hang until 100s timeout → simultaneous link failures on all sysbench-2 threads → MO rejects new logins during reconnect storm.

Not caused by sysbench-2’s -d 60000 or thread count alone: duration was logged correctly; failure coincides with MO +Inf / proxy errors, not timer expiry.

Expected vs actual (MO)

Expected Actual for sysbench-2
MO serves sysbench_test2 on sbtest continuously for multi-day stability ~2h15m then no successful queries; connections dead/unusable
Plan/explain JSON always finite +Inf → marshal error on CN
Graceful degradation under load Hard connection loss on all sysbench-2 sessions

Proposed fixes (matrixone)

P0 — Code

  1. pkg/sql/plan/stats.go: safeRatio() for every Selectivity division; clamp/guard Cost and TableCnt before divide.
  2. pkg/frontend/mysql_cmd_executor.go: ensure marshal path never sees non-finite floats (belt-and-suspenders).
  3. Regression test using SQL shapes similar to sysbench mixed (UPDATE … WHERE id, SELECT … WHERE id, small-cardinality stats edge cases).

P1 — Verify on stability replay

Re-run only sysbench-longrunning-test-2 against 177ed31 (or fixed build) for >3h; Loki must show zero +Inf plan errors; sysbench-2 test.log must not show cluster-wide link failure at 13:35-class timestamps.

Reproduce (minimal)

  1. Deploy mo-stb-177ed31-202605171112 (SHA 177ed31).
  2. Start sysbench-2 command above (or CI equivalent for sysbench-longrunning-test-2 only).
  3. Wait >2h with mixed OLTP on sbtest tables.
  4. Confirm Loki +Inf + sysbench-2 Communications link failure at same window.

Related

  • mo-load (client): how sysbench-2 process exits after MO outage — not tracked here.
  • sysbench-1 on same host at same time may recover while test2 sessions stay broken; MO fault is still CN/plan JSON class, not account-specific logic in MO.

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