Skip to content

[Bug]: TestPartitionBasedShardCanBeCreated flakes after HAKeeper connection reset #26091

Closed

Description

@ck89119

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Issue #24618 tracks a different failure signature in the same test
(transaction ... has been committed or aborted). This report tracks a
HAKeeper/logservice connection reset before the test database can be created.

Branch Name

main

Commit ID

1ac64a8

Other Environment Information

  • Hardware parameters: GitHub Actions hosted runner
  • OS type: Ubuntu/x86
  • Go version: 1.26.4
  • Workflow: MatrixOne ALL CI, UT Test on Ubuntu/x86

Actual Behavior

TestPartitionBasedShardCanBeCreated in pkg/tests/shard failed while creating
its test database:

logservice/store.go:813 propose failed: invalid deadline
hakeeper_client.go:464 failed to allocate id:
writeto tcp4 127.0.0.1:54666->127.0.0.1:16020:
read tcp4 127.0.0.1:54666->127.0.0.1:16020:
read: connection reset by peer

--- FAIL: TestPartitionBasedShardCanBeCreated (41.08s)

The embedded cluster also reported that the system was busy and CN heartbeats
exceeded their deadlines immediately before the logservice connection reset.

CI run:
https://github.com/matrixorigin/matrixone/actions/runs/29985797682/job/89137225057

This was observed on PR #26021. That PR does not change pkg/tests/shard,
pkg/shardservice, or the embedded test-cluster setup. The focused test passed
once on the PR head and five consecutive times on a clean main worktree at
1ac64a870, which indicates an intermittent infrastructure or embedded-cluster
lifecycle failure rather than a deterministic assertion failure.

Expected Behavior

The embedded HAKeeper/logservice connection should remain available throughout
test setup, and TestPartitionBasedShardCanBeCreated should not fail because
the service connection is reset.

Steps to Reproduce

make ut

Focused diagnostic command:

.agents/skills/mo-dev/scripts/mo-cgo-test \
  -v -count=5 -timeout=300s \
  -run '^TestPartitionBasedShardCanBeCreated$' \
  ./pkg/tests/shard

The failure is intermittent and has currently only been observed in the full
Ubuntu/x86 CI UT workload.

Additional information

Relevant sequence from the CI log:

system is busy {"expect": "1s", "actual": "3.284240492s"}
failed to send cn heartbeat: context deadline exceeded
propose failed: invalid deadline
failed to allocate id: ... connection reset by peer

Activity

  1. added
    kind/bug
    on Jul 23, 2026
  2. LeftHandCold commented on Jul 27, 2026

    @LeftHandCold
    Collaborator

    Another occurrence with the same HAKeeper/logservice failure signature was observed on PR #26096.

    Failure chain from the job log:

    raft: dropped proposal, no leader
    logservice: proposal timeout
    frontend: failed to get connection ID from HAKeeper: context deadline exceeded
    dragonboat: had 8 LocalTick msgs in one batch
    logservice: specified timeout value is too small / proposal timeout
    HAKeeper client: 127.0.0.1:16020 read: connection reset by peer
    --- FAIL: TestDeleteAndSelect (33.14s)
    

    This occurred in the heavy race-test phase (go test -race, package parallelism 3). The same test passed on the exact same PR head in the coverage UT job in 13.2s, and a focused local race run also passed:

    .agents/skills/mo-dev/scripts/mo-cgo-test -race -tags matrixone_test -short -count=1 -timeout=300s -run ^TestDeleteAndSelect$ ./pkg/tests/dml
    ok github.com/matrixorigin/matrixone/pkg/tests/dml 17.520s
    

    PR #26096 does not change pkg/tests/dml, pkg/embed, pkg/logservice, pkg/cnservice, pkg/tnservice, or pkg/common/morpc. This is therefore another intermittent full-race-workload occurrence rather than a deterministic regression from that PR. The delayed Dragonboat tick batches immediately before HAKeeper deadlines provide additional evidence that runner scheduling/resource pressure is the trigger; the embedded cluster currently does not tolerate that delay without dropping control-plane RPCs.

  3. gouhongshen commented on Jul 30, 2026

    @gouhongshen
    Contributor

    A new occurrence with the same embedded HAKeeper/TN connection-reset signature appeared in PR #26369's third Ubuntu/x86 UT attempt.

    The PR changes only pkg/frontend/data_branch.go; the same head passed the complete Ubuntu/x86 UT once, so this is unrelated to PR #26369. The two previous reruns failed in different embedded-cluster consumers with the same timeout/connection-reset family.

    Latest main at 2e6877406 still starts all CN operators concurrently in pkg/embed.cluster.doStartLocked; each CN reaches bootstrap concurrently, and a transient backend disconnect is converted into a process-wide panic by handleBootstrapErr. PR #26409 removed one unnecessary full-cluster test but did not change TestBasicCluster or this startup contract.

    Focused validation on latest main passed TestBasicCluster 5/5 locally in 75.6s, confirming that the failure is load-sensitive. The issue is therefore still present structurally and requires a deterministic stress/fault regression test before changing behavior.

  4. added
    severity/s0
    ai-heavy
    and removed on Jul 30, 2026
  5. self-assigned this
    on Jul 30, 2026
  6. gouhongshen commented on Jul 30, 2026

    @gouhongshen
    Contributor

    A root-cause fix is now available in draft PR #26414. It retries the complete bootstrap transaction only after a transient connection error and a durable-state check confirms bootstrap is incomplete; this also handles a lost successful commit response without duplicating initialization.

  7. removed their assignment
    on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-heavybug/utkind/bugphase/testingseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions