Skip to content

fix: increase stdio buffer limit to prevent LimitOverrunError#2616

Merged
crivetimihai merged 1 commit intoIBM:mainfrom
jonathan-fulton:fix/stdio-buffer-limit-overrun
Jan 31, 2026
Merged

fix: increase stdio buffer limit to prevent LimitOverrunError#2616
crivetimihai merged 1 commit intoIBM:mainfrom
jonathan-fulton:fix/stdio-buffer-limit-overrun

Conversation

@jonathan-fulton
Copy link
Copy Markdown
Contributor

Summary

Increases the asyncio subprocess buffer limit from the default 64KB to 16MB to handle tools that return large responses.

Problem

When using mcpgateway.translate (via cforge run) with tools that return large results, the bridge crashes with LimitOverrunError:

asyncio.exceptions.LimitOverrunError: Separator is found, but chunk is longer than limit
ValueError: Separator is found, but chunk is longer than limit

This happens because the default asyncio buffer limit (64KB) is exceeded when tools return large amounts of data (e.g., GitHub search results).

Solution

  • Add STDIO_BUFFER_LIMIT constant set to 16MB
  • Pass this limit to asyncio.create_subprocess_exec()

Testing

Tested with the GitHub MCP server running searches that return many results.

Fixes #2591

@jonathan-fulton jonathan-fulton force-pushed the fix/stdio-buffer-limit-overrun branch from 279dfac to 1582568 Compare January 31, 2026 18:38
@crivetimihai crivetimihai self-assigned this Jan 31, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0-RC1 milestone Jan 31, 2026
@crivetimihai
Copy link
Copy Markdown
Member

Thanks @jonathan-fulton! Good fix for the buffer overflow issue. 16MB is a reasonable limit for large tool responses like GitHub search results. I noticed there are a few other create_subprocess_exec calls in translate.py that might benefit from the same fix in the future, but this covers the main StdIOEndpoint code path. I'll start merging and rebasing.

The default asyncio subprocess buffer limit (64KB) is too small for tools
that return large responses (e.g., GitHub PR search results). This causes
LimitOverrunError when the response exceeds the buffer size.

Increase the buffer limit to 16MB to handle large tool responses reliably.

Fixes IBM#2591

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
@crivetimihai crivetimihai force-pushed the fix/stdio-buffer-limit-overrun branch from 1582568 to 2bb8303 Compare January 31, 2026 20:13
@crivetimihai crivetimihai merged commit 4ec41c7 into IBM:main Jan 31, 2026
48 checks passed
hughhennelly pushed a commit to hughhennelly/mcp-context-forge that referenced this pull request Feb 8, 2026
The default asyncio subprocess buffer limit (64KB) is too small for tools
that return large responses (e.g., GitHub PR search results). This causes
LimitOverrunError when the response exceeds the buffer size.

Increase the buffer limit to 16MB to handle large tool responses reliably.

Fixes IBM#2591

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
Signed-off-by: hughhennnelly <hughhennelly06@gmail.com>
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
The default asyncio subprocess buffer limit (64KB) is too small for tools
that return large responses (e.g., GitHub PR search results). This causes
LimitOverrunError when the response exceeds the buffer size.

Increase the buffer limit to 16MB to handle large tool responses reliably.

Fixes IBM#2591

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
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.

[BUG]: LimitOverrunError with translate for stdio server

2 participants