Skip to content

tnet: support graceful restart#31

Merged
WineChord merged 1 commit into
trpc-group:mainfrom
Rememorio:sync_graceful_restart
Jun 18, 2026
Merged

tnet: support graceful restart#31
WineChord merged 1 commit into
trpc-group:mainfrom
Rememorio:sync_graceful_restart

Conversation

@Rememorio

Copy link
Copy Markdown
Contributor

Summary

  • Add optional Restartable for services that support graceful restart while keeping Service unchanged.
  • Add TCP graceful restart that starts a child process with the listener fd, stops accepting new connections, and waits for active connections to drain.
  • Add UDP graceful restart that starts a child process with the first packet connection fd and closes the old packet connections.
  • Add WithGracefulRestartTimeout and targeted restart tests.

Compatibility

This keeps the existing Service interface source-compatible. Callers that need restart can opt in with a type assertion to Restartable; existing custom Service implementations do not need to add a new method.

Validation

  • go test . -run 'Restart|TCPConnWritevOutboundBufferLimitExceeded|TCPService|UDPService|ServiceClose|ConvertPacketConn' -count=1
  • go test . -count=1
  • go test $(go list ./... | grep -v '/internal/reuseport') -count=1
  • go vet $(go list ./... | grep -v '/internal/reuseport')

Note: local go test ./... -count=1 still fails in internal/reuseport on this macOS environment; the PR changes do not touch that package. Local golangci-lint is v2 and cannot load this repository's v1 config, so lint is left to CI.

@WineChord WineChord left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WineChord WineChord merged commit 660a85d into trpc-group:main Jun 18, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants