fix(node): handle SIGTERM across startup phases#6620
Open
paolino wants to merge 3 commits into
Open
Conversation
paolino
marked this pull request as draft
July 16, 2026 15:33
paolino
force-pushed
the
fix/sigterm-startup-shutdown
branch
from
July 16, 2026 17:26
508760c to
9bf4bfa
Compare
paolino
marked this pull request as ready for review
July 17, 2026 06:15
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.
Description
Handle
SIGTERMcorrectly whilecardano-nodeis loading its configuration.A
SIGTERMreceived during startup was previously delivered asExitSuccess. Configuration parsing could catch and wrap that exception, producing a generic parse error and making the process exit with status 1 instead of shutting down successfully.This change introduces a phase-aware signal path:
SIGTERMthrows a dedicated asynchronousSigTermException.ExitSuccess.ExitSuccess, which the diffusion layer already recognizes as an expected runtime shutdown.This prevents configuration parsers from treating startup termination as a parsing failure while preserving the existing runtime shutdown behavior.
Regression tests
The deterministic
cardano-node-testproperties cover the signal path without relying on process-start timing:SigTermExceptionis classified asSomeAsyncException, so ordinary configuration-parser exception handling cannot wrap it.SigTermExceptiontoExitSuccess.SIGTERM; the top-level handler must then exit successfully.The installed-handler property passed 100 tests locally. The previous process-level test was removed because its fixed startup delay raced with handler installation on Linux and macOS CI.
Antithesis reproduction
Antithesis originally exposed this intermittent failure in run
75fa032ed4fd4931ff63d020d9f48208-56-17.Failing property:
Relevant run logs:
The patched image was subsequently exercised in three-hour Antithesis run
ce9c380a77c6c17f77edae0f35146a08-56-17:OtherParseException: 0 eventsGeneric parse exception: 0 eventsThe clean three-hour run is broader fault-injection regression coverage, not proof of the fix by itself: the failure is intermittent and unpatched runs also completed without reproducing it. The deterministic properties above provide red/green coverage of async classification, top-level conversion, phase selection, and actual POSIX signal delivery.
The Antithesis reports are restricted to authorized tenant users, so the stable run IDs and reviewer-safe log excerpts are included here instead of access-dependent report URLs.
Local verification
nix develop --quiet -c cabal test cardano-node-testpasses; all five top-level SIGTERM properties pass 100 tests.nix build --no-link .#hydraJobs.x86_64-linux.windows.cardano-nodepasses the same Windows cross-build that previously failed under-Werror.nix develop --quiet -c cabal build cardano-testnet-testpasses after removing the timing-based property.hlintreportsNo hintsfor all touched Haskell files.Checklist
SIGTERMhlintstylish-haskellghc-9.6andghc-9.12Note on CI
This PR is from a fork, so the necessary CI jobs will need to be triggered by someone with write privileges.