Skip to content

Cancelling with CTRL+c leaves zombie processes of forks workers #9123

@AriPerkkio

Description

@AriPerkkio

Describe the bug

When running Vitest in run-mode and doing a non-graceful exit with CTRL+c, the forks workers are sometimes left running in the background even though main process exits.

In my case I'm not spawning any additional processes during the test run. Graceful exit in watch-mode kills the worker properly.

Reproduction

Reproduces the issue but is not (yet) minimal one:

vitest-fork-zombie.webm

System Info

System:
    OS: macOS 15.6.1
    CPU: (8) arm64 Apple M2
    Memory: 444.67 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 22.18.0 - /Users/ari/.nvm/versions/node/v22.18.0/bin/node
    npm: 11.6.0 - /Users/ari/.nvm/versions/node/v22.18.0/bin/npm
    pnpm: 10.23.0 - /Users/ari/.nvm/versions/node/v22.18.0/bin/pnpm
    bun: 1.2.21 - /Users/ari/.bun/bin/bun
    Deno: 2.3.6 - /Users/ari/.deno/bin/deno
  Browsers:
    Brave Browser: 131.1.73.101
    Chrome: 142.0.7444.176
    Firefox: 135.0
    Safari: 18.6
  npmPackages:
    @vitejs/plugin-vue: ^6.0.2 => 6.0.2 
    @vitest/coverage-istanbul: ^4.0.13 => 4.0.13 
    @vitest/coverage-v8: ^4.0.13 => 4.0.13 
    vite: ^7.2.4 => 7.2.4 
    vitest: ^4.0.13 => 4.0.13

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

Labels

p4-importantViolate documented behavior or significantly improves performance (priority)

Type

Projects

Status

Approved

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions