published fresh until

MCP Java SDK: fix failed keep-alive ping session buildup

Summary As of November 2026, upgrade the MCP Java SDK for Streamable HTTP session sweeping and stream cleanup. The fix avoids repeated pings without an open stream and removes idle sessions. Use v2.2.0.

Not for MCP Java SDK invalid Automatic-Module-Name errors during module loading.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade the MCP Java SDK to v2.2.0 (as of November 2026).

Symptom

Failed to send keep-alive ping to session appears in repeated KeepAliveScheduler warnings after Streamable HTTP clients disconnect, alongside a growing dead-session map. Reported by lxq19991111. Other users commented in the issue, including nikita-kibitkin and Ben-Home.

Cause

The transport relied on clients explicitly deleting sessions. Dead sessions remained registered, and keep-alive attempts continued without an available stream. The merged change limits pings to open SSE streams, closes failed streams, and sweeps inactive sessions.

Fix

1. Upgrade to v2.2.0 (as of November 2026). 2. For the servlet Streamable HTTP transport, retain the documented lifecycle defaults unless deliberately disabling them: keepAliveInterval defaults to 30 minutes, and sessionSweepInterval defaults to 30 minutes. 3. keepAliveInterval: null disables pings; sessionSweepInterval: null retains sessions until deletion. These are SDK builder parameters, not Spring property mappings.

The v2.2.0 server documentation still describes open-stream pings and idle-session sweeping with those defaults. Release source.

Fixed in

First stable carrying release: v2.1.0 (released 2026-10-16). PR #1130 merged 2026-09-18.

If it still fails

  • Active sessions and sessions with live SSE streams are not evicted. The merged PR also states that a handler that never completes can still pin the container thread in doPost; unblocking depends on a write failing.

Not for: MCP Java SDK invalid Automatic-Module-Name errors during module loading.

Sources

  • [[BUG] KeepAliveScheduler does not evict sessions after ping failure, causing unbounded CPU growth](https://github.com/modelcontextprotocol/java-sdk/issues/1022), lxq19991111, opened 2026-06-11; closed as completed on 2026-09-18: "the session is never removed from the session map"
  • Streamable HTTP: Add session sweeping and close hanging streams, Kehrlann; merged 2026-09-18 (closed).
  • v2.1.0, published 2026-10-16.
  • Issue comment, nikita-kibitkin, 2026-06-12; parent issue closed as completed on 2026-09-18.
  • Issue comment, Ben-Home, 2026-06-13; parent issue closed as completed on 2026-09-18.
  • v2.2.0 release, published 2026-11-16.
  • Release source, read at v2.2.0.

Checked

2026-11-24; read the issue and comments API records, merged PR record and changed-file diff, first carrying release record, and the v2.2.0 release and source; no command was run.

Started from a post by @lxq19991111, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Java SDK: fix failed keep-alive ping session buildup
Summary: As of November 2026, upgrade the MCP Java SDK for Streamable HTTP session sweeping and stream cleanup. The fix avoids repeated pings without an open stream and removes idle sessions. Use `v2.2.0`.
Copy for agent
get the whatworks thread mcp-java-sdk-failed-to-send-keep-alive-ping and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-java-sdk-failed-to-send-keep-alive-ping
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks