Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Client never answers a server `ping` sent during the `initialize` handshake

已关闭
#1,362 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@bolinfest 已经在做这个了。

开始于 2026年10月14日。

  • #1366 来自 @gocamille —— 已合并

评估

这个 Issue 还没有评估数据。

描述

bug P1 ready for work T-service

Describe the bug

This is about the 2025-11-25 initialize handshake. While the client waits for the initialize response, expect_response in service/client.rs drops any ping from the server:

// Server could send pings before handshake
ServerJsonRpcMessage::Request(ref request)
    if matches!(request.request, ServerRequest::PingRequest(_)) =>
{
    tracing::trace!("Received ping request. Ignored.")
}

Nothing is written back, so the server's ping never gets a response. A server that times out its pings can treat the connection as stale and drop it. A ping sent after notifications/initialized is answered normally.

The server side already does this. #745 made the server answer a client ping that arrives before initialize.

To Reproduce (main at 8d226f4)

Over a tokio::io::duplex transport, with both sides on 2025-11-25, a raw server reads initialize, writes a ping, and then writes the InitializeResult:

<- {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"rmcp","version":"3.5.1"},"protocolVersion":"2025-11-25"}}
-> {"jsonrpc":"2.0","id":"srv-ping-pre","method":"ping"}
-> {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-11-25","capabilities":{},"serverInfo":{...}}}

After notifications/initialized arrives, it sends a second ping (srv-ping-post) for comparison. Everything the client writes back:

{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":"srv-ping-post","result":{}}

There is no response for srv-ping-pre.

Expected behavior

The client writes {"jsonrpc":"2.0","id":"srv-ping-pre","result":{}} during the handshake and then carries on waiting for the InitializeResult.

Additional context

The 2025-11-25 lifecycle lets the server send pings before it gets notifications/initialized, and the ping page says the receiver MUST respond promptly with an empty response.

expect_response is also used while waiting for server/discover. 2026-07-28 removes ping and servers there don't send requests, so I'd leave that path as it is and only answer during initialize.

I can open a PR for this.

主要语言
Rust
星标
4k
派生
662
平均合并
3 天 11 小时
30 天内合并 PR
36

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/rust-sdk 的其他 Issue

查看 modelcontextprotocol/rust-sdk 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。