device: set peer to expire unconditionally#73
Open
illotum wants to merge 1 commit into
Open
Conversation
bd72938 to
abe4007
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses a resource leak for lazily-created peers (via PeerLookupFunc) that never complete a handshake by ensuring the peer expiry timer is armed even if no session is established. This prevents leaked goroutines and buffer retention on failed/non-started handshakes in the device package.
Changes:
- Arm
zeroKeyMaterialexpiry for lazily-created peers duringDevice.LookupPeer. - Add a synctest-based unit test to verify lazy peers are reaped after
RejectAfterTime*3even without a successful handshake.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| device/device.go | Arms the lazy peer reaping timer during LookupPeer so peers without successful handshakes are reclaimed. |
| device/failed_handshake_test.go | Adds a synctest-based test asserting lazy peers are removed after the expiry deadline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
abe4007 to
d942d22
Compare
e3ac4a0 introduced lightweight API that can be used instead of UAPI to reconfigure peers. Peer state created via the new PeerLookupFunc is not set to expire until the handshake succeeds. Device leaks two goroutines and a set of buffers for each failed handshake. This change arms the expiry timer before the handshake gets to proceed. Updates tailscale/tailscale#20183 Signed-off-by: Alex Valiushko <alexvaliushko@tailscale.com> Change-Id: Ibc0abb6eec97aca0a10f50515dea9e0d6a6a6964
d942d22 to
e83a51f
Compare
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.
e3ac4a0 introduced lightweight API that can be used instead of UAPI to reconfigure peers. Peer state created via the new PeerLookupFunc is not set to expire until the handshake succeeds, making device leak two goroutines and a set of buffers for each failed handshake.
This change arms the expiry timer before the handshake gets to proceed.
Updates tailscale/tailscale#20183