Skip to content

fix(core): properly cleanup worker processes on SIGINT/SIGTERM#880

Merged
9aoy merged 2 commits intomainfrom
orphaned-process
Jan 19, 2026
Merged

fix(core): properly cleanup worker processes on SIGINT/SIGTERM#880
9aoy merged 2 commits intomainfrom
orphaned-process

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jan 19, 2026

Summary

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

This fix adds signal handlers for SIGINT and SIGTERM that properly:

  • Call runGlobalTeardown()
  • Call pool.close() to terminate worker processes
  • Call closeServer() to clean up the dev server

The fix applies to both watch mode and non-watch mode.

Related Links

Fixes #876

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

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

This fix adds signal handlers for SIGINT and SIGTERM that properly:
- Call runGlobalTeardown()
- Call pool.close() to terminate worker processes
- Call closeServer() to clean up the dev server

The fix applies to both watch mode and non-watch mode.

Fixes #876
Copilot AI review requested due to automatic review settings January 19, 2026 07:31
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 19, 2026

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit fa96730
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/696de5f70aa8ff0008765f60
😎 Deploy Preview https://deploy-preview-880--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where worker processes were not properly cleaned up when tests were interrupted with SIGINT or SIGTERM signals. The fix adds signal handlers that ensure proper cleanup of global teardown, worker pool, and dev server resources.

Changes:

  • Added SIGINT/SIGTERM signal handlers to properly clean up resources on interruption
  • Modified Ctrl+C handling in CLI shortcuts to delegate to signal handlers
  • Implemented cleanup guards to prevent duplicate cleanup operations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/core/src/core/runTests.ts Added signal handlers for both watch and non-watch modes with cleanup() function to handle runGlobalTeardown, pool.close, and closeServer
packages/core/src/core/cliShortcuts.ts Changed Ctrl+C handling to send SIGINT signal instead of calling process.exit(0) directly
packages/core/src/cli/commands.ts Added signal handler installation for non-watch mode with cleanup in finally block

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

@9aoy 9aoy merged commit 22141ec into main Jan 19, 2026
12 checks passed
@9aoy 9aoy deleted the orphaned-process branch January 19, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants