Repository navigation
feat(input): preserve accepted connections across reloads - #475
Merged
Merged
Conversation
added 7 commits
November 3, 2026 09:14
Sync the decoder copy with the receiver: reserve an upper bound for an uncompressed snapshot instead of growing it while many connections hand over their state together.
timtofan
requested review from
Joypaul11,
deniszh,
emadolsky and
grzkv
as code owners
November 3, 2026 08:38
emadolsky
approved these changes
Nov 4, 2026
deniszh
approved these changes
Nov 4, 2026
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.
Depends on #474
Why
A graceful reload inherits listeners but closes accepted sockets. Unread successful writes, partial lines, and incomplete frames can disappear even while parsed output drains. Persistent clients need their accepted input preserved through a compatible replacement.
Architecture
The ready-successor exchange negotiates input handoff version 1. After readiness and any service-manager ownership barrier, the predecessor transfers each accepted socket and a raw state pipe over a private Unix socket using SCM_RIGHTS. Parsed records stay with the old pipeline; the successor routes the unparsed tail under its new configuration.
Plaintext preserves partial lines. Stream input replays RESET/STATE names and predictors before buffered wire bytes. Streaming zstd journals the current frame in an unlinked file and skips previously consumed plaintext on replay. Bounded read-ahead starts before state generation and spills excess bytes to temporary storage.
Older binaries cannot restore accepted state, so both upgrade and rollback retain the original PID-only readiness and connection-close fallback until both processes support the same version. Transfer errors keep the live successor running and expose unparsed input at risk through counters and unsampled error logs.
Before / after
Usage
The existing SIGUSR2 path uses handoff automatically between compatible binaries. No producer switch is required. Reserve temporary-storage headroom for compressed-frame journals and read-ahead spill; monitor handoff success and failure counters.
docs/input-reload.mddocuments the exchange and the local persistent-client harness. Crashes and ambiguous output writes retain TCP's existing uncertainty.Validation
Go 1.27.0, vendored dependencies: build, vet, serialized full tests, and upstream-configured golangci-lint v2. Tests cover byte-cut boundaries, continuous zstd flushes, inherited state, read-ahead spill, and admission rejection. The external receiver harness and larger dictionary stress test remain separately invoked checks.