Skip to content

test: standalone cluster loses cleanup ownership before Start and on completed diagnostic errors #29640

Closed

Description

@XuPeng-SH

Description

Related: #29249, remaining ownership reconciliation #29627; current baseline bdf3c91.

Observed at the actual current worktree using a private Go overlay and the repository CGo wrapper, GOMAXPROCS=2, GOMEMLIMIT=2GiB, -p=1 -parallel=1 -count=1. No service/network cluster was started.

  1. A tnService initialized with an existing tnservice.Service consumer and status ServiceInitialized returns nil from Close without calling the backend destructor (exact calls0; contract expects1).
  2. cnService has the same defect, and its cancellation owner is also bypassed. Exact backend calls0; contract expects1.
  3. A testCluster owning real LocalFS at fileServices.s3FS returns nil from Close before Start. A one-byte public Write materializes one open directory descriptor; /proc/self/fd shows the descriptor remains1 after cluster.Close, expected0. keepData=true correctly keeps bytes; it should not retain cache or descriptor resources. Probe cleanup manually closes the real FS afterward.

Source ownership: NewCluster creates shared/ETL/TNlocal/CNlocal file services; services borrow composite wrappers. fileServices has no destructor. Close's !running branch only releases admission. Initialized wrapper Close only acts on ServiceStarted. LOG construction separately creates a live service before the wrapper's no-op Start, so analogous initialized LOG handling must be included (currently source-proven, not runtime-probe-proven).

Required invariant: construction establishes effective destruction ownership immediately. Own files and services exactly once, even before Start or after failed Start. Preserve producer->dependency teardown ordering, and do not release shared FS/admission on an incomplete drain. Existing CN.CloseComplete distinguishes local completion from remote diagnostic errors; TN drain error leaves local dependencies alive. Neither error aggregation nor unconditional cleanup alone closes this class.

Regression requirements: initialized and failed-Start service teardown, repeated Close, exact cancellation and destructor counts, real descriptor release with retained data, parent/shared borrower survival, partial batch construction failure, diagnostic-complete versus incomplete drain, same fixture's admission retention/release and dynamic CN expansion. Preserve existing service/status/topology consumers and public tests.

Design and implementation are in progress. Related prerequisite #29639 proves the TN constructor ownership gap. This issue does not claim factories are exception-safe; dependency-aware constructor rollback must be established before automatic fixture rollback can safely destroy borrowed storage.

Additional independent control

TestQAClusterCloseSeparatesDiagnosticFromIncompleteDrain has two named cases. Incomplete drain passes: no FS destructor and admission retained. Completed-with-diagnostic fails: an actual wrapper ignores the backend's existing CloseComplete() == true, reports ServiceStarted instead of ServiceClosed. Both cases preserve the original error; package runtime 0.041s. Assertions after the failed status comparison are not credited as executed.

Activity

  1. self-assigned this
    on Oct 6, 2026
  2. added
    kind/bug
    severity/s0
    on Oct 6, 2026
  3. added a commit that references this issue on Oct 9, 2026
    23d8f61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions