Skip to content

test(cli-repl): fix CTRL-C server-side termination tests for server 9.0 MONGOSH-3378 - #2762

Closed
nbbeeken wants to merge 3 commits into
mainfrom
MONGOSH-3412-ctrl-c-termination-server-9.0
Closed

test(cli-repl): fix CTRL-C server-side termination tests for server 9.0 MONGOSH-3378#2762
nbbeeken wants to merge 3 commits into
mainfrom
MONGOSH-3412-ctrl-c-termination-server-9.0

Conversation

@nbbeeken

@nbbeeken nbbeeken commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

On server 9.0, in-progress operations that use server-side JavaScript ($where) are no longer killed when the initiating client disconnects — the mechanism mongosh uses to terminate server-side operations on CTRL-C. This broke the CTRL-C termination tests on mlatest.

Interrupt-on-disconnect support varies by op type and version

Verified via standalone repro + the CI matrix on this PR's earlier patch:

Op type 4.1–7.0 8.0–8.3 9.0
$where JS loop killed ✓ killed ✓ survives
nested $reduce (non-JS) survives killed ✓ killed ✓

(The socket really closes in all cases — serverStatus.connections.current drops; what differs is whether the op's evaluation reaches an interrupt point that honors the disconnect kill.)

Changes

  • The two terminates operations tests are defined once and run in two version-gated contexts: with a $where JS loop on >= 4.1 < 8.0 and with a non-JS nested-$reduce op on >= 8.0. CTRL-C termination coverage runs on all supported server versions.
  • A for server >= 9.0 canary asserts server-side JS operations survive CTRL-C, pinning the 9.0 behavior change. If a future 9.x reinstates JS kill-on-disconnect, the canary fails and prompts restoring JS-based coverage.

Ruled out

The recent node driver fix (NODE-7411) only affects multi-server topologies; these tests use a standalone, and the same driver shows version-dependent behavior.

No single server ticket pins the 9.0 JS regression; likely owner is Query Execution (server-side JS interrupt points) rather than Networking & Observability (whose markKillOnClientDisconnect still works for non-JS ops on 8.0+). Being raised with the server team.

Fixes MONGOSH-3378, MONGOSH-3381, MONGOSH-3382, MONGOSH-3412, MONGOSH-3413.

Copilot AI review requested due to automatic review settings July 7, 2026 18:00
@nbbeeken
nbbeeken requested a review from a team as a code owner July 7, 2026 18:00
@nbbeeken
nbbeeken requested a review from mabaasit July 7, 2026 18:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the CLI REPL CTRL‑C integration tests to account for MongoDB Server 9.0 no longer killing in-progress operations on client disconnect (the mechanism mongosh relied on for server-side CTRL‑C termination), while adding a canary test to detect if 9.x behavior changes again.

Changes:

  • Skip the existing “server >= 4.1 terminates operations on the server side” CTRL‑C termination tests when running against server >= 9.0.0-0.
  • Add a new “server >= 9.0” canary test asserting that the server-side operation continues running after CTRL‑C (and then explicitly kills it via killOp for suite cleanup).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli-repl/src/cli-repl.spec.ts
@nbbeeken nbbeeken changed the title test(cli-repl): guard CTRL-C server-side termination tests for server 9.0 test(cli-repl): guard CTRL-C server-side termination tests for server 9.0 MONGOSH-3412 Jul 7, 2026
@nbbeeken nbbeeken changed the title test(cli-repl): guard CTRL-C server-side termination tests for server 9.0 MONGOSH-3412 test(cli-repl): fix CTRL-C server-side termination tests for server 9.0 Jul 8, 2026
@nbbeeken nbbeeken changed the title test(cli-repl): fix CTRL-C server-side termination tests for server 9.0 test(cli-repl): fix CTRL-C server-side termination tests for server 9.0 MONGOSH-3378 Jul 8, 2026
@nbbeeken
nbbeeken force-pushed the MONGOSH-3412-ctrl-c-termination-server-9.0 branch from 67a9b13 to 3cdf8b7 Compare July 8, 2026 19:41
nbbeeken added 3 commits July 10, 2026 13:51
… 9.0

Server 9.0 no longer kills in-progress operations on client disconnect,
the mechanism mongosh uses to terminate ops on CTRL-C. Skip the affected
tests on >= 9.0 and add a canary asserting the new behavior.

MONGOSH-3378 MONGOSH-3381 MONGOSH-3382 MONGOSH-3412 MONGOSH-3413
The 9.0 disconnect-kill change is isolated to server-side JavaScript: a
non-JS op (nested $reduce) is still killed on client disconnect on 9.0,
while a $where JS loop is not. Switch the termination tests to a non-JS
op so they run and pass on all server versions (drop the >= 9.0 skip),
and keep the $where-based >= 9.0 test as a canary for the JS behavior.
…pport

Interrupt-on-client-disconnect coverage varies by server version and op
type: $where JS loops are interrupted on 4.1-8.x but not on 9.0, while
the non-JS nested-$reduce op is interrupted on 8.0+ only (CI confirmed
it survives on 4.2-7.0). Run the termination tests with $where on
< 8.0 and with the non-JS op on >= 8.0, so they pass on all versions,
and keep the >= 9.0 canary asserting JS ops are no longer interrupted.
@nbbeeken
nbbeeken force-pushed the MONGOSH-3412-ctrl-c-termination-server-9.0 branch from 3cdf8b7 to acdd358 Compare July 10, 2026 17:51
@nbbeeken nbbeeken closed this Jul 11, 2026
@nbbeeken

Copy link
Copy Markdown
Collaborator Author

@nbbeeken
nbbeeken deleted the MONGOSH-3412-ctrl-c-termination-server-9.0 branch July 11, 2026 17:34
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