fix: 10k concurrency stress tests and fixes - #128
Merged
Conversation
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
- Introduced stress tests for memstore to validate concurrent access and defensive copies. - Added performance tests for smdclient to ensure token refresh coalescing and component information caching. - Enhanced existing tests to cover edge cases and ensure data integrity during concurrent operations. - Implemented mutex locks in smdclient for safe access to shared resources. - Updated tunnels package with stress tests for IP allocation under concurrent conditions. - Improved test coverage for peer removal operations in the tunnels package. Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
# Conflicts: # cmd/cloud-init-server/handlers.go # pkg/wgtunnel/tunnels_test.go
synackd
self-requested a review
August 25, 2026 15:59
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
travisbcotton
approved these changes
Aug 25, 2026
travisbcotton
left a comment
Collaborator
There was a problem hiding this comment.
Looks ok to me after the IP release fix
synackd
reviewed
Aug 25, 2026
synackd
reviewed
Aug 25, 2026
This was referenced Aug 31, 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.
Description
This pull request introduces a new asynchronous, backpressured queue for removing WireGuard peers, refactors the
PhoneHomeHandlerto use this queue, and adds comprehensive stress and unit tests for the queue and for defensive copying inMemStore. Additionally, it ensures that all data returned fromMemStoreis defensively copied to prevent concurrent mutation bugs. The release workflow is updated to run new stress tests.WireGuard Peer Removal Queue:
PeerRemovalQueue, an asynchronous, backpressured queue for removing WireGuard peers, replacing direct removal calls with a bounded worker pool to prevent resource exhaustion and provide backpressure if the queue is full. (cmd/cloud-init-server/peer_removal_queue.go)PhoneHomeHandlerto usePeerRemovalQueueinstead of directly calling the WireGuard interface manager, returning HTTP 503 if the queue is full. (cmd/cloud-init-server/handlers.go,cmd/cloud-init-server/main.go) [1] [2] [3] [4] [5] [6]Testing and CI Improvements:
PeerRemovalQueueto validate queue bounds, concurrency, and handler responses under load. (cmd/cloud-init-server/peer_removal_queue_test.go,cmd/cloud-init-server/peer_removal_queue_stress_test.go) [1] [2].github/workflows/Release.yml)Defensive Copying in MemStore:
MemStoremethods to return deep defensive copies of stored data, preventing concurrent mutation and data races. New helper functions perform deep copying of maps, slices, and nested structures. (internal/memstore/ciMemStore.go) [1] [2] [3] [4] [5] [6] [7] [8]MemStoredoes not affect the underlying store. (internal/memstore/ciMemStore_stress_test.go)Dependency and Import Cleanups:
cmd/cloud-init-server/handlers.go,internal/memstore/ciMemStore.go) [1] [2]Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change
For more info, see Contributing Guidelines.