GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: keep stdio client reading after a malformed response by hpdkhoa · Pull Request #1158 · modelcontextprotocol/java-sdk

Conversation

@hpdkhoa

@hpdkhoa hpdkhoa commented Oct 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The stdio client's inbound loop stopped at the first message it could not deserialize. It then marked the transport as closing and completed the inbound stream, so the request answered by that message timed out and so did every later request on the same client, including ping.

A message that fails to deserialize no longer ends the loop. If it is a response with a usable id, the transport emits an error response for that id, so the matching request fails right away with an internal error. A line that is not JSON at all is logged and skipped.

The new test runs a server process that sends a response without jsonrpc, a response with both result and error, a line that is not JSON, and then a valid response, and checks that the two malformed responses fail their requests and the valid one still arrives.

Fixes #1157

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hpdkhoa
fix: keep stdio client reading after a malformed response
4ca7e6b
The stdio client's inbound loop stopped at the first message it could not
deserialize. It then marked the transport as closing and completed the
inbound stream, so the request answered by that message timed out and so
did every later request on the same client, including ping.

A message that fails to deserialize no longer ends the loop. If it is a
response with a usable id, the transport emits an error response for that
id, so the matching request fails right away with an internal error. A
line that is not JSON at all is logged and skipped.

The new test runs a server process that sends a response without jsonrpc,
a response with both result and error, a line that is not JSON, and then a
valid response, and checks that the two malformed responses fail their
requests and the valid one still arrives.

Fixes modelcontextprotocol#1157
This was referenced Oct 3, 2026
fix: reject invalid JSON-RPC response versions #1161
Closed
fix: reject invalid JSON-RPC response versions #1162
Open
@hpdkhoa

hpdkhoa commented Oct 10, 2026

Copy link
Copy Markdown
Author

Hi @Kehrlann, this is the fix for #1157, where I described the scope. In short: one malformed response no longer stops the stdio client's read loop. A response-shaped line with a usable id becomes an INTERNAL_ERROR response for that id, so the waiting request fails at once, and later messages still arrive. All mcp-core tests pass. Happy to change the error code if you prefer INVALID_REQUEST or PARSE_ERROR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hpdkhoa added 2 commits October 10, 2026 15:39
@hpdkhoa
Merge branch 'main' into fix/stdio-malformed-response-recovery
fca4ae9
@hpdkhoa
Merge branch 'main' into fix/stdio-malformed-response-recovery
2acf34c

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Stdio client stops processing responses after rejecting a malformed response

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@hpdkhoa
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.