fix(mcp): serialize keepalive probes with the per-server RPC lock - #76691
Closed
686f6c61 wants to merge 1 commit into
Closed
fix(mcp): serialize keepalive probes with the per-server RPC lock#76691686f6c61 wants to merge 1 commit into
686f6c61 wants to merge 1 commit into
Conversation
Keepalive ping/list_tools no longer interleave with in-flight tool calls on the same ClientSession stream. If the lock is already held, skip the probe (the active RPC is liveness). Otherwise acquire the lock for the probe. Fixes NousResearch#70218 Co-authored-by: Diego Gomez <22959713+0xquinto@users.noreply.github.com>
Collaborator
Contributor
Author
|
Agreed — #62811 is the earlier open implementation of the same |
Contributor
Author
|
Duplicate of #62811 — earlier open PR for the same keepalive/RPC serialization fix. |
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.
What does this PR do?
Normal MCP tool RPCs are serialized on per-server
_rpc_lock, but_keepalive_probe()sentping/list_toolswithout the lock. A scheduled probe can interleave with a long-running tool call and wedge the session (#70218).This PR:
_rpc_lockis already held (active RPC proves liveness)_rpc_lockfor the whole probesessionreference for the probe durationRelated work
Fixes #70218
Related open approaches: #62811 (same serialization idea; this branch is rebased on current main and linked to the issue). Happy for maintainers to pick either and close the other as superseded.
Test plan
2/2 passed.