Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#1,362 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@bolinfest ci sta già lavorando.

Dal 14/10/2026.

  • #1366 di @gocamille — integrata

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Rust
Stelle
4k
Fork
662
Merge medio
3g 11h
PR unite (30g)
36

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/rust-sdk

Tutte le issue di modelcontextprotocol/rust-sdk

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.