Skip to content

Kill stdio MCP children when a dial is interrupted - #1654

Merged
RhysSullivan merged 1 commit into
mainfrom
fix/stdio-interrupt-child-leak
Aug 18, 2026
Merged

Kill stdio MCP children when a dial is interrupted#1654
RhysSullivan merged 1 commit into
mainfrom
fix/stdio-interrupt-child-leak

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Fixes#1631.

Cancelling an in-flight health check or tool discovery (HTTP 499 on app refresh, or the 15s discovery timeout) abandoned the MCP connect handshake without closing the transport. The spawned stdio child stayed alive indefinitely; for docker run -i --rm integrations that stranded one container per interrupted dial.

  • connectClient now passes the Effect.tryPromise abort signal into client.connect. On interruption the SDK fails the handshake and closes the transport (stdin end, then SIGTERM/SIGKILL), so the child exits.
  • discoverTools wraps acquire/use in uninterruptibleMask so an interrupt landing between the handshake succeeding and the onExit cleanup attaching can no longer leak the connection. Connect and listTools stay restored, so cancellation and the discovery timeout still land promptly.
  • Regression tests spawn a real stdio fixture and assert child-process lifetime across the three paths: uninterrupted discovery, fiber interrupt mid-handshake, and the discovery timeout. Both interrupt tests fail on main.

@cloudflare-workers-and-pages

cloudflare-workers-and-pagesBot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with Cloudflare Workers Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

StatusNameLatest CommitUpdated (UTC)
✅ Deployment successful!
View logs
executor-cloud73cdb9fAug 18 2026, 04:12 PM

@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@pkg-pr-new

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1654

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1654

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1654

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1654

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1654

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1654

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1654

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1654

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1654

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1654

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1654

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1654

executor

npm i https://pkg.pr.new/executor@1654

commit: 73cdb9f

@RhysSullivan
RhysSullivan marked this pull request as ready for review August 18, 2026 16:19
@RhysSullivan
RhysSullivan merged commit 256e25e into mainAug 18, 2026
43 checks passed
@RhysSullivanRhysSullivan mentioned this pull request Aug 18, 2026
@RhysSullivan
RhysSullivan deleted the fix/stdio-interrupt-child-leak branch August 18, 2026 16:23
Sign up for freeto 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.

Interrupted stdio health checks leave stranded Docker containers

1 participant

@RhysSullivan