Repository navigation
Description
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.
- 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).
- cnService has the same defect, and its cancellation owner is also bypassed. Exact backend calls0; contract expects1.
- 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
fix: retain service owners during construction (#29676)