Skip to content

[Bug]: Orphaned tinypool worker processes after SIGINT/test interruption #876

@s-cork

Description

@s-cork

Version

System:
      OS: macOS 15.5
      CPU: (10) arm64 Apple M1 Pro
      Memory: 380.23 MB / 32.00 GB
      Shell: 5.9 - /bin/zsh
    Browsers:
      Brave Browser: 143.1.85.111
      Chrome: 143.0.7499.193
      Firefox: 140.0.4
      Safari: 18.5
    npmPackages:
      @rstest/core: ^0.7.9 => 0.7.9

Details

When tests are interrupted (e.g., with Ctrl+C/SIGINT), tinypool worker processes are not properly cleaned up and continue running indefinitely, consuming high CPU.

Impact:

  • Orphaned workers accumulate over time and consume significant system resources
  • Workers continue running at high CPU usage even after the test process exits
  • Multiple interrupted test runs create multiple orphaned workers that must be manually killed
  • This causes severe performance degradation on development machines

Example:
After interrupting tests, orphaned worker processes remain active:

  $ pgrep -fl "tinypool.*process.js"
  20946 node ... tinypool/dist/entry/process.js

Reproduce link

https://github.com/s-cork/rstest-orphaned-workers-repro

Reproduce Steps

  1. Clone the reproduction repository:
    git clone https://github.com/s-cork/rstest-orphaned-workers-repro
    cd rstest-orphaned-workers-repro
    npm install
  2. Start the test suite:
    npm test
  3. While tests are running, interrupt with Ctrl+C (SIGINT)
  4. Check for orphaned processes:
    pgrep -fl "tinypool.*process.js"
  5. Observe that tinypool worker processes are still running

Expected: Workers should be terminated when the parent test process exits
Actual: Workers continue running indefinitely and must be manually killed

Cleanup: pkill -9 -f "tinypool.*process.js"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions