Repository navigation
fix: preserve NodeHost constructor unwind and release partial resources - #18
Merged
Merged
Conversation
Merged
1 task done
volgariver6
approved these changes
Oct 7, 2026
XuPeng-SH
added a commit
to matrixorigin/matrixone
that referenced
this pull request
Oct 7, 2026
…29649) ## What type of PR is this? - [x] BUG ## Which issue(s) this PR fixes: Fixes #29641 ## What this PR does / why we need it: Dragonboat NewNodeHost swallowed non-error panics, changed error-valued panic identity and leaked its directory lock on Goexit. NewTransport could also lose a returned child before constructor handoff. Pin Dragonboat to `abc3d2fce5a6b82b3a8a922c342fd1ec4afb8df3` (matrixorigin/dragonboat#18): each existing constructor owner keeps rollback until successful return and reuses its shared destruction path, preserving the primary failure. Transport Close now stops and joins the receiver before cleaning snapshot chunks. Otherwise a final valid receive can recreate `.receiving` storage after cleanup. The shared path covers ordinary shutdown and partial-start rollback, including returned child Close errors. Existing EngineConfig validation also rejects snapshot/close worker counts beyond Go's reflect.Select hard limit before acquisition. No new state machine, engine rollback framework or steady-state work is added. Remove the unused testutil import that blocked this branch's function-package compilation. This matches the existing correction on main (#29648), without pulling in its other changes. The MatrixOne regression exercises the actual public constructor with StrictMem LogDB injection and no bound ports, checking ordinary errors, panic identity, Goexit and exactly-once lock cleanup. Dependency regressions reuse existing fixtures and validate ownership handoff, receiver draining with both Close outcomes, terminal snapshot-directory cleanup, and unsafe configuration rejection before acquisition. Validation (Go 1.26.4, Linux/amd64): - Prior implementations fail the new ownership, terminal-directory and invalid-worker-count oracles; passing ordinary-error/success controls distinguish the defects. - Dragonboat config/root/transport packages normal and race PASS. Receiver-drain regression ×100 race PASS; nine actual-constructor QA cases PASS under race. - Full MatrixOne pkg/logservice normal/race PASS (104.129s/109.050s). Six existing function execution-contract tests normal/race PASS. Published-pin constructor and actual LOG create/close/retry consumers PASS under race. - Incremental formatting, vet and configured golangci-lint PASS for affected packages, with zero introduced findings. MatrixOne molint completes successfully; its two unchanged baseline checkunsafe diagnostics are outside this delta. - Downloaded dependency origin/checksums verified; 41 relevant module/config/root/transport files match the tested source byte for byte. Required gpt-6.1-sol/xhigh design, overall review and final pin/evidence reconciliation are recorded. Merge Dragonboat #18 first. Custom child Close retains its requirement to terminate and join callbacks; resources a factory never returns and arbitrary fatal/nonterminating destructors retain their existing contracts. Hard worker-count limits do not guarantee affordability of extremely large configurations. Local validation is distinct from hosted CI; new-head CI is not claimed green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NewNodeHost previously swallowed non-error panics, changed error-valued panic identity and leaked its directory lock on Goexit. NewTransport could also lose an acquired child before handoff. Keep rollback at each existing constructor owner until successful return, reuse the shared destruction paths, and remove recovery/type filtering and duplicate error-branch cleanup.
Transport shutdown now stops and joins its receiver before cleaning snapshot chunks. A final admitted receive can otherwise recreate
.receivingstorage after cleanup. The same close path covers ordinary shutdown and partial-start rollback; returned child Close errors are preserved and do not skip chunk cleanup.Existing EngineConfig validation rejects snapshot/close worker counts exceeding Go's 65,536-case reflect.Select limit. This closes the impossible-length configuration boundary without adding engine rollback state, arbitrary limits on other shard counts, or another cleanup framework. Default configurations, APIs and wire/persisted formats are unchanged. All added work is in construction or shutdown.
Focused tests reuse existing factories, NOOP transport and StrictMem fixtures. They cover error/panic/Goexit identity, exactly-once resource cleanup, successful handoff, a valid final snapshot chunk during receiver drain with both Close outcomes, and configuration rejection before acquisition. No sockets, sleeps, large data or production test hooks are added.
Validation (Go 1.26.4, Linux/amd64):
Refs matrixorigin/matrixone#29641. Companion integration: matrixorigin/matrixone#29649. Merge this dependency PR first. Custom child Close retains its existing requirement to terminate and join callbacks; factory-internal resources not returned and arbitrary fatal/nonterminating destructors keep their existing contracts. Hard select limits are not an affordability guarantee for extremely large worker configurations. Hosted CI is reported separately from local validation.