Skip to content

feat: support capture stderr when 'Worker exited unexpectedly' error#949

Closed
9aoy wants to merge 7 commits intomainfrom
stderrCapture
Closed

feat: support capture stderr when 'Worker exited unexpectedly' error#949
9aoy wants to merge 7 commits intomainfrom
stderrCapture

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Feb 6, 2026

Summary

Captures related stderr output from child processes so that it can be attached to "Worker exited unexpectedly" errors.

image

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings February 6, 2026 09:45
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 adds functionality to capture stderr output from worker processes and attach it to "Worker exited unexpectedly" errors, improving debugging experience when workers crash unexpectedly.

Changes:

  • Adds stderr capture mechanism that intercepts process.stderr.write to collect recent stderr output
  • Prefixes worker stderr with [Worker:stderr] tag for identification
  • Integrates stderr capture into the pool error handling to enhance worker crash errors

Reviewed changes

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

File Description
packages/core/src/pool/stderrCapture.ts New file implementing stderr capture with EventEmitter-based communication and error enhancement logic
packages/core/src/runtime/worker/setup.ts Adds stderr interception in worker processes to prefix output with [Worker:stderr] tag
packages/core/src/reporter/windowedRenderer.ts Integrates with stderr capture by emitting events when error stream data is intercepted
packages/core/src/pool/index.ts Integrates stderr capture into pool creation, enhances worker errors, and ensures cleanup on close

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

9aoy and others added 3 commits February 6, 2026 17:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks too complex 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

tinypool pipes the child process stderr directly to the parent process, so we need some extra handling here. 😢

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

📝 Rstest Ecosystem CI: Open

suite result
rspress ✅ success
rsbuild ✅ success
rslib ✅ success
rsdoctor ✅ success
modernjs ✅ success

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.

3 participants