-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix stack overflow in Bun.inspect for circular JSX elements #30126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+31
−2
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2089,6 +2089,7 @@ pub mod formatter { | |
| | Tag::Error | ||
| | Tag::Class | ||
| | Tag::Event | ||
| | Tag::JSX | ||
| ) | ||
| } | ||
| } | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 🟡 Nit: CodeRabbit's suggestion you partially applied in 61823f2 also filtered the
WARNING: ASAN interferes with JSC signal handlers…banner that ASAN builds write to stderr at startup (see expectations.txt:15 and the 17 sibling subprocess tests — e.g. string_decoder.test.js:303-307, setTimeout.test.js:429 — that strip it before asserting empty stderr). With a rawexpect(stderr).toBe("")this test may go red on the linux-asan job; the one-line filter is cheap insurance:Extended reasoning...
What this is
Commit 61823f2 addressed the earlier review by reading
proc.stderr.text()and reordering the assertions, but dropped one piece of CodeRabbit's committable suggestion (inline comment 3177287793): the filter for the ASAN startup banner. On linux ASAN builds, thebun-asanbinary may writeWARNING: ASAN interferes with JSC signal handlers; …to stderr during JSC initialization (the comment atstring_decoder.test.js:303attributes it to WebKit'sOptions.cpp, which is not in this checkout).bunEnv(test/harness.ts:72-74) setsASAN_OPTIONS=allow_user_segv_handler=1:disable_coredump=0, which does not suppress that banner. With the newexpect(stderr).toBe("")at line 342, the linux-asan job would seereceived: "WARNING: ASAN interferes with JSC signal handlers; …\n"and fail this test.Why existing safeguards don't prevent it
There is no harness helper that strips this line — every subprocess test that wants to assert empty stderr under ASAN does it inline. Seventeen test files in the repo currently filter exactly this prefix (e.g.
test/js/node/string_decoder/string-decoder.test.js:305-308,test/js/web/timers/setTimeout.test.js:429,test/js/bun/resolve/bun-main-entry-point.test.ts:16,test/js/node/buffer-copy-fill-detach.test.ts:23,test/js/bun/udp/udp_socket.test.ts:39,test/regression/issue/29519.test.ts), several with a verbatim comment that "ASAN builds unconditionally print … to stderr at startup". Andtest/expectations.txt:15skipschild_process.test.tson ASAN with the note# Unexpected identifier "WARNING"— independent evidence that the banner is real on the ASAN builder, not just a CodeRabbit-learned cargo-cult.Step-by-step proof
bunExe()(=bun-asan) with-e <script>andenv: bunEnv.Options::initialize(), the ASAN-aware path emitsWARNING: ASAN interferes with JSC signal handlers; …\nto stderr before any user code runs.<div …>lines to stdout, exits 0.proc.stderr.text()resolves to"WARNING: ASAN interferes with JSC signal handlers; …\n".expect(stderr).toBe("")fails; the stdout/exitCode assertions never run.Addressing the refutation
One reviewer points out that the literal
fprintfis not insrc/(only the comment atZigGlobalObject.cpp:288), thattest/CLAUDE.md's canonical spawn pattern is the unfilteredexpect(stderr).toBe(""), and that ~80 other tests use that unfiltered form without being listed as ASAN failures inexpectations.txt. That's all accurate, and it's why this is a nit rather than a guaranteed CI break: either the banner is gated on something not every test hits, or the linux-asan job tolerates/curates these. But theexpectations.txtskip (Unexpected identifier "WARNING") and the seventeen explicit filters — including one merged the day before this PR in #30058 — are direct evidence that the banner does surface on the ASAN builder for at least somebunExe()spawns. Since CodeRabbit already proposed the filter on this exact diff and the author applied two-thirds of that suggestion, finishing it is the path of least resistance.Fix
(or the two-
.filter()form from CodeRabbit's committable suggestion). Test-only, no behavior change on non-ASAN builds.