Skip to content

mcp: log a keepalive session close at Warn, not Error - #1282

Open
oplatonov wants to merge 1 commit into
modelcontextprotocol:mainfrom
oplatonov:keepalive-warn
Open

oplatonov wants to merge 1 commit into
modelcontextprotocol:mainfrom
oplatonov:keepalive-warn

Conversation

@oplatonov

Copy link
Copy Markdown

Fixes #1281

When the keepalive failure threshold is reached, startKeepalive logs "keepalive ping failed; closing session" at Error. In practice this is almost always a client that went away, the normal end of a session, so on a long-running server these records drown out real errors (the issue has numbers: 1281 of 1285 Error records over 23 days).

This logs it at Warn, the same level as the below-threshold case right above it and as a failed notification delivery in notifySessions. TestKeepAliveFailure_Logged now captures at Warn and checks the level; it fails without the change. go vet ./... and go test -race ./... pass.

When the keepalive failure threshold is reached, startKeepalive logs
"keepalive ping failed; closing session" at Error. In practice this is
almost always a client that went away, the normal end of a session, so
on a long-running server these records drown out real errors.

Log it at Warn, the same level as the below-threshold case and as a
failed notification delivery in notifySessions.

Fixes modelcontextprotocol#1281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: keepalive logs an ordinary client disconnect at Error, drowning real failures

1 participant