Skip to content

(docs): Make stdio shutdown sequence platform-neutral#2466

Merged
localden merged 1 commit intomainfrom
den/fix-1090-windows-stdio-shutdown
Mar 25, 2026
Merged

(docs): Make stdio shutdown sequence platform-neutral#2466
localden merged 1 commit intomainfrom
den/fix-1090-windows-stdio-shutdown

Conversation

@localden
Copy link
Copy Markdown
Contributor

Fixes #1090.

Problem

The stdio shutdown sequence in lifecycle.mdx prescribes closing stdin, then sending SIGTERM, then SIGKILL. These signals are POSIX-only. On Windows there is no clean equivalent: TerminateProcess is a hard kill (no handlers run), and GenerateConsoleCtrlEvent has enough caveats that libuv explicitly declined to implement it.

A survey of the four official SDKs shows none of them attempt a graceful-signal intermediate step on Windows. They all close stdin, wait, then hard-kill via TerminateProcess or TerminateJobObject. The spec's three-step escalation effectively collapses to two steps on Windows.

Changes

Platform-neutral steps. Restructured the numbered list to describe intent (close stdin → wait → force-kill) rather than POSIX mechanics. Added a follow-up paragraph naming the platform-specific APIs with links to their documentation: POSIX signal.h (Open Group), Win32 TerminateProcess and Job Objects (Microsoft Learn).

Server-side EOF obligation. Added a normative SHOULD that servers exit promptly when stdin closes or returns EOF. Per Larry Osterman's comment, this is the real fix: if servers honor stdin closure, forced termination becomes a rare fallback rather than the norm. Stdin close is the only portable graceful-shutdown signal.

Scope

Draft spec only.

@localden localden requested a review from a team as a code owner March 25, 2026 19:35
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Mar 25, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
mcp-staging 🟢 Ready View Preview Mar 25, 2026, 7:43 PM

@localden localden changed the title spec: make stdio shutdown sequence platform-neutral (docs): Make stdio shutdown sequence platform-neutral Mar 25, 2026
@localden localden added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 25, 2026
The stdio shutdown sequence referenced SIGTERM and SIGKILL, which are
POSIX-only. Windows has no direct equivalent; TerminateProcess is a
hard kill with no graceful intermediate step.

Restructured the client steps to describe intent (close stdin, wait,
force-kill) rather than POSIX mechanics, with a follow-up paragraph
naming the platform-specific APIs and linking to their documentation.

Added a normative SHOULD that servers exit on stdin EOF. This is the
only portable graceful-shutdown signal, and honoring it reduces the
need for forced termination. All four official SDKs already rely on
stdin closure as the graceful phase on Windows.

Applied to draft only.

Fixes #1090

🏠 Remote-Dev: homespace
Copy link
Copy Markdown
Member

@jonathanhefner jonathanhefner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@localden
Copy link
Copy Markdown
Contributor Author

/lgtm force

Given Jonathan's approval above.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on behalf of @localden via /lgtm force.

@localden localden merged commit fd59119 into main Mar 25, 2026
11 checks passed
@localden localden deleted the den/fix-1090-windows-stdio-shutdown branch March 25, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify stdio-transport shutdown sequence for Windows

2 participants