fix: make chanSend non-blocking to prevent panic on closed channel#2286
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 31, 2026
Merged
Conversation
The RAG file watcher runs for the lifetime of the agent but holds a closure over the per-message events channel. When finalizeEventChannel closes that channel between messages, the watcher panics with "send on closed channel". Make chanSend non-blocking with select/default and recover from panics on closed channels, so late-arriving RAG events are safely dropped. Fixes docker#2266 Assisted-By: docker-agent
aheritier
approved these changes
Mar 31, 2026
aheritier
reviewed
Mar 31, 2026
| github.com/opencontainers/go-digest v1.0.0 // indirect | ||
| github.com/opencontainers/image-spec v1.1.1 // indirect | ||
| github.com/patrickmn/go-cache v2.1.0+incompatible // indirect | ||
| github.com/patrickmn/go-cache v2.1.0+incompatible |
Contributor
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.
The RAG file watcher runs for the lifetime of the agent but holds a closure over the per-message events channel. When
finalizeEventChannelcloses that channel between messages, the watcher panics withsend on closed channel.Make
chanSendnon-blocking withselect/defaultand recover from panics on closed channels, so late-arriving RAG events are safely dropped.Fixes #2266