Skip to content

fix(ext/node): unref child_process stdio streams by default#32071

Merged
fraidev merged 2 commits intodenoland:mainfrom
fraidev:fix-fresh-hangs
Feb 6, 2026
Merged

fix(ext/node): unref child_process stdio streams by default#32071
fraidev merged 2 commits intodenoland:mainfrom
fraidev:fix-fresh-hangs

Conversation

@fraidev
Copy link
Copy Markdown
Contributor

@fraidev fraidev commented Feb 5, 2026

Closes #32064

PR #31975 made child process stdio streams into Socket instances backed by Pipe → StreamResource. When libraries like esbuild call child.unref() / stdout.unref() to signal the event loop should be free to exit, the call chain was Socket.unref() → Pipe.unref() → only unrefs #listener (null for non-server pipes) → StreamResource never gets unref'd → process hangs.

With this fix, Pipe.unref() also propagates to the stream in [kStreamBaseField], so esbuild's unref calls reach the StreamResource and the event loop can exit properly.

@fraidev fraidev marked this pull request as ready for review February 5, 2026 21:45
@fraidev fraidev force-pushed the fix-fresh-hangs branch 3 times, most recently from 31d2905 to f5f8773 Compare February 6, 2026 04:08
Copy link
Copy Markdown
Contributor

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

LGTM!

@fraidev fraidev merged commit 84339a8 into denoland:main Feb 6, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fresh build hangs in canary

2 participants