everything: remove disconnected sessions from resource subscriptions - #4716
Open
vishalhabib99 wants to merge 1 commit into
Open
everything: remove disconnected sessions from resource subscriptions#4716vishalhabib99 wants to merge 1 commit into
vishalhabib99 wants to merge 1 commit into
Conversation
subscriptions (Map<uri, Set<sessionId>>) only ever had entries removed via an explicit resources/unsubscribe call. A session that disconnects without unsubscribing stayed in every Set it had joined for the life of the process, since cleanup(sessionId) stopped logging/update intervals and task-store timers but never touched subscriptions. Add removeSubscriber(sessionId), which drops the session from every URI's subscriber set and removes any URI entry left with no subscribers, and call it from cleanup(). Fixes modelcontextprotocol#4710
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.
subscriptions(Map<uri, Set<sessionId>>) only ever had entries removed via an explicitresources/unsubscribecall. A session that disconnects without unsubscribing stayed in everySetit had joined for the life of the process, sincecleanup(sessionId)stopped logging/update intervals and task-store timers but never touchedsubscriptions.Adds
removeSubscriber(sessionId), which drops the session from every URI's subscriber set and removes any URI entry left with no subscribers, and calls it fromcleanup().Fixes #4710
(Re-opened as a fresh PR — the original #4711 was closed automatically when my fork was deleted; same fix, no changes.)