Skip to content

fix: web adapter hang on large responses (>100KB) + ProviderManager timeout race condition - #9

Merged
YumaKakuya merged 2 commits into
mainfrom
cto/fix-web-timeout-and-provider-race
May 3, 2026
Merged

YumaKakuya merged 2 commits into
mainfrom
cto/fix-web-timeout-and-provider-race

Conversation

@sorted-ai-bot

Copy link
Copy Markdown
Collaborator

Summary

Two critical fixes ported from MCPHUB (same codebase):

Fix 1: Web adapter hangs on large HTTP responses

  • Bug: When an HTTP response exceeds MAX_BODY_CHARS * 2 (100KB), res.destroy() prevented the 'end' event from firing, causing the httpRequest Promise to hang forever until the 30-second timeout.
  • Fix: Call resolve() immediately before res.destroy() when truncation is triggered.
  • File: adapters/web/index.ts

Fix 2: ProviderManager race condition after timeout

  • Bug: When a provider call timed out, the abandoned virtual thread consumed the next stdout response, desynchronizing all subsequent request/response pairs.
  • Fix: On timeout or stdout close, kill and restart the broken provider process.
  • File: java/src/main/java/dev/sorted/mcphub/ProviderManager.java

@YumaKakuya
YumaKakuya merged commit 1012fa7 into main May 3, 2026
2 checks passed
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.

2 participants