servers icon indicating copy to clipboard operation
servers copied to clipboard

everything: cancelled long-running operation delays stdio shutdown

Open anilloutombam opened this issue 2 months ago • 2 comments

Version

@modelcontextprotocol/server-everything 2026.8.31 Node.js 26.5.0 macOS arm64

Reproduction

  1. Start the Everything server over stdio.
  2. Call trigger-long-running-operation with duration 2 and steps 4.
  3. Cancel the request after 400 ms.
  4. Call echo on the same session.
  5. Close the client with a 400 ms cleanup limit.

Observed

The operation timed out at about 403 ms and echo succeeded on the same session. Client cleanup then exceeded 400 ms.

This reproduced three times. Normal stdio cleanup passed when no operation was cancelled. The equivalent Streamable HTTP test also cleaned up normally.

The long-running tool waits on timers and does not check request cancellation, so the handler can continue after the client cancels it.

Expected

The demonstration operation should stop after cancellation so stdio shutdown is not delayed by the original timer loop.

Report

The commands and test results are in anilloutombam/mcp-failure-lab#89: https://github.com/anilloutombam/mcp-failure-lab/pull/89

anilloutombam avatar Sep 24 '26 13:09 anilloutombam

Triage: Priority Low (total 5)

  • Severity 2: trigger-long-running-operation ignores request cancellation and keeps its timer loop running after the client cancels, so pending timers can delay stdio shutdown; the demo should stop on the request's abort signal.
  • Urgency 2: wanted eventually
  • Bonuses: +1 bug label

Still present on v2 (checked by reading the current code).

Board: Servers V2 (#43), Status Incoming, awaiting maintainer review (no milestone yet). Part of the backlog triage in #4875.

cliffhall avatar Oct 19 '26 16:10 cliffhall

Prior work, from the PR backlog triage (#4877). These outside pull requests addressed this issue against the pre-refactor code:

  • #4847 by @Ewertonslv

They are being closed as part of the backlog triage in #4875, since the repository now takes issues rather than outside PRs and their diffs predate the v2 refactor. They stay readable and serve as prototypes for the fix here. Thank you to their authors.

cliffhall avatar Oct 20 '26 06:10 cliffhall