fix: clean up listenQueues entry on listener disconnect#397
Merged
raballew merged 1 commit intojumpstarter-dev:mainfrom Apr 6, 2026
Merged
fix: clean up listenQueues entry on listener disconnect#397raballew merged 1 commit intojumpstarter-dev:mainfrom
raballew merged 1 commit intojumpstarter-dev:mainfrom
Conversation
The listenQueues sync.Map entry created via LoadOrStore in Listen() was never deleted when a listener disconnected, causing unbounded memory growth over time as orphaned channels accumulated. Adds defer s.cleanupListenQueue(leaseName) after LoadOrStore to ensure the map entry is removed when Listen() returns for any reason (context cancellation, stream send failure, etc.). Closes jumpstarter-dev#362 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
❌ Deploy Preview for jumpstarter-docs failed. Why did it fail? →
|
Member
|
Hmm, I thought this had already been fixed, let me read :) thanks @raballew !! |
mangelajo
reviewed
Apr 6, 2026
| } | ||
|
|
||
| queue, _ := s.listenQueues.LoadOrStore(leaseName, make(chan *pb.ListenResponse, 8)) | ||
| defer s.cleanupListenQueue(leaseName) |
Member
There was a problem hiding this comment.
I believe you could have simply defer s.listenQueues.Delete(leaseName) :)
but that's fine :D
mangelajo
approved these changes
Apr 6, 2026
This was referenced Apr 7, 2026
ambient-code bot
pushed a commit
that referenced
this pull request
Apr 7, 2026
This reverts commit 4a10a94.
mangelajo
added a commit
that referenced
this pull request
Apr 7, 2026
revert: revert "fix: clean up listenQueues entry on listener disconnect (#397)"
This was referenced Apr 7, 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.
Summary
listenQueuessync.Map in the controller never cleaned up entries when a listener disconnected, causing unbounded memory growth over time as orphaned channels accumulateddefer s.cleanupListenQueue(leaseName)afterLoadOrStoreinListen()so the entry is removed when the function returns for any reason (context cancellation, stream send failure, etc.)Test plan
Closes #362
🤖 Generated with Claude Code