fix(node): Don't recurse in logAndExitProcess on a broken stdio pipe - #24351
Open
logaretm wants to merge 3 commits into
Open
fix(node): Don't recurse in logAndExitProcess on a broken stdio pipe#24351logaretm wants to merge 3 commits into
logaretm wants to merge 3 commits into
Conversation
logAndExitProcess writes the error to stderr before shutting down. When stderr is a broken pipe that write raises EPIPE, which surfaces as another uncaught exception and lands back in the handler. Nothing guarded that path, so every pass queued another console write and another client.close() until V8 aborted with a heap OOM. Guard on re-entry and return, leaving the shutdown already in flight to exit. Returning rather than exiting immediately keeps the client.close() flush that the first call started, so the fatal event still reaches Sentry. Since that first call is now solely responsible for exiting, also exit from the client.close() rejection path, which previously only logged.
Contributor
size-limit report 📦
|
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 63c7a7b. Configure here.
logaretm
marked this pull request as ready for review
September 12, 2026 00:20
logaretm
requested review from
JPeer264 and
isaacs
and removed request for
a team
September 12, 2026 00:20
This was referenced Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A broken stdio pipe crashed Node with an OOM, fixed by making
logAndExitProcessnow guards against re-entry.I added a broken pipe test that reproduces the issue before the fix.
closes #24337