mcp: keepalive logs an ordinary client disconnect at Error, drowning real failures
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in mcp/shared.go:885 at startKeepalive and compare its disconnect logging with notifySessions in server.go:779. Reproduce the streamable-HTTP client disconnect described in the issue, then verify that ordinary session loss is logged at Warn while genuine keepalive failures remain distinguishable.
Written by the indexing model from the issue text.
Description
A client going away is the normal end of a session, and startKeepalive reports it at Error (mcp/shared.go:885, v1.7.0). On a long-running streamable-HTTP server that is nearly every session, so the level buries whatever else the server has to say.
Numbers from one shared daemon over 23 days and 4096 handled requests:
1285 level=ERROR, total
1281 msg="keepalive ping failed; closing session"
4 actual failures (three of them a caller's own bad arguments)
So 99.7% of the Error records are clients that disconnected.
To reproduce: point a streamable-HTTP client at the server, POST a request, and do not hold the SSE stream open. The next ping fails and the session closes with consecutiveFailures=1 failureThreshold=1.
KeepAliveFailureThreshold from #982 does not help here. The transport is gone, so the retry fails the same way one interval later; the record moves, it does not go away.
The PR that added this line (#887) left notifySessions at Warn for a delivery failure (server.go:779), which is the same class of event: the session cannot be reached. The asymmetry looks unintended rather than deliberate, and Warn would match.
Related: #218 (the ErrorHandler this logging stands in for), #865, #887, #982, #900, #1204.
- Dominant language
- Go
- Stars
- 5.1k
- Forks
- 543
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/go-sdk
-
P3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/go-sdk#1204 ·
-
needs investigation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/go-sdk#745 · 13 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
modelcontextprotocol/go-sdk#1284 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
modelcontextprotocol/go-sdk#1272 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
modelcontextprotocol/go-sdk#1265 ·
All issues in modelcontextprotocol/go-sdk
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100