Repository navigation
fix(mcp): serialize server start/stop so overlapping calls cannot leak a socket host (#1563) - #1692
Merged
Merged
Conversation
…ls cannot leak a socket host (#1563)
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.
Closes #1563.
McpServerController.start()checked_host != null, then awaited the app version andhost.start(), and only then assigned_host. Two overlapping calls (a toggle clicked twice,startIfEnabledracing the settings page,regenerateTokenduring a start) both passed the check and each built a host; the first was overwritten and left listening, and both wrote the endpoint file.stop()during a start closed nothing.start,stopandregenerateTokennow run one after another through a small chain (_serialized); a failed step does not break the chain for the next one.regenerateTokenis one step (stop and start with nothing in between), so another call cannot slip into the gap.Tests: three overlapping
start()calls produce one port and nothing listens on it afterstop();stop()queued behind a runningstart()leaves the server stopped with no endpoint file; start, stop, start works.