Commit 51b0797
fix: prevent createDeferred from keeping Node.js process alive (#2588)
* fix: prevent createDeferred from keeping Node.js process alive
The scheduler uses MessageChannel internally for task scheduling.
In Node.js (with -C browser flag), active MessagePort listeners
keep the event loop alive even after all work is done and dispose()
has been called. This causes the process to hang indefinitely.
The fix calls unref() on both MessageChannel ports so they don't
prevent natural process exit. The unref method is Node.js-specific
and doesn't exist in browsers, so we guard the call with a typeof
check.
Fixes #2570
* add changeset for createDeferred node hang fix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent a0524c0 commit 51b0797
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
0 commit comments