Skip to content

[Bug]: pkg/embed cluster cleanup can return bad connection and poison remaining tests #27072

Closed

Description

@gouhongshen

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main (observed in PR #27070's pull_request_target coverage run)

Commit ID

  • PR head: c2c6734b8ee95276de0222e81b52174ac13a8d74
  • PR base: 6a29b7d47eae06b414cce51ede4a129b6da9b68a

Other Environment Information

Actual Behavior

pkg/embed.TestBasicCluster completes its functional assertions, but its t.Cleanup call to c.Close() returns bad connection at cluster_test.go:94:

cluster_test.go:94:
    Error: Received unexpected error:
           bad connection
    Test:  TestBasicCluster
--- FAIL: TestBasicCluster (20.42s)

Because failed shutdown retains the complete test-cluster admission token, every later test that needs a non-concurrent embedded cluster fails immediately with:

invalid state another complete test cluster is already active in this process

The coverage report recorded 18 failed tests in pkg/embed: the first shutdown failure and 17 cascading admission failures. The package failed after 50.311 seconds. The downstream Matrixone Utils CI / Coverage job then failed only because a required producer had failed:

coverage merge skipped because at least one required producer was skipped or failed

Expected Behavior

Closing a successfully started test cluster should reliably drain services without returning a transient database connection error. A cleanup error should not poison every remaining embedded-cluster test in the process.

Steps to Reproduce

  1. Check out main at 6a29b7d47eae06b414cce51ede4a129b6da9b68a or inspect the linked run at the PR head.
  2. Run the Ubuntu x86 unit-test coverage job, which executes the repository unit-test suite under coverage.
  3. Observe pkg/embed.TestBasicCluster pass its three validCNCanWork checks, then fail while closing the cluster.
  4. Observe subsequent pkg/embed tests fail at startup because the complete-cluster admission token remains held.

This appears intermittent; the linked attempt preserves the full diagnostic JSON and failure summary.

Additional information

This failure is unrelated to PR #27070:

  • that PR changes temporary-table clone handling in pkg/frontend and pkg/sql/compile and adds its tests; it does not modify pkg/embed or embedded-cluster ownership;
  • TestBasicCluster only executes select count(1) from mo_catalog.mo_tables through the internal executor and creates no clone or temporary table;
  • the first failure is returned by embedded service shutdown, while fix: support cloning into temporary tables #27070's session cleanup API returns no error and its new physical cleanup branch requires at least one session temporary table;
  • the clone-specific frontend/compile package tests, race tests, and distributed regression passed locally, and both CI BVT producers passed in the same workflow run.

Root-cause work should identify which embedded service Close propagated bad connection, make the shutdown ownership decision explicit, and ensure the global cluster admission token can be safely released or retried without cascading failures.

Activity

  1. added
    kind/bug
    on Aug 12, 2026
  2. self-assigned this
    on Aug 12, 2026
  3. added
    severity/s0
    ai-easy
    and removed on Aug 12, 2026
  4. added a commit that references this issue on Aug 13, 2026
    56ee2d0
  5. added 3 commits that reference this issue on Sep 17, 2026
    da619a8
    4b67e2b
    316b24d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions