Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 56 seconds Limit details: You’ve used all 5 included reviews currently available under your plan. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
Comment |
|
Updated 9:59 AM PT - Sep 11th, 2026
❌ @robobun, your commit eaf28d4 has 1 failures in
🧪 To try this PR locally: bunx bun-pr 37941That installs a local version of the PR into your bun-37941 --bun |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. The Bun-side diff is small and the two new stress fixtures look correct (the requireOptions directive is parsed by the existing harness, and the SuppressedError assertions are exact). That said, this pins WebKit to a preview build of an unmerged PR and pulls in everything between the old pin and current WebKit main (including oven-sh/WebKit#410) — a maintainer should sign off on shipping against a preview tag and on the wider engine bump.
Extended reasoning...
Overview
This PR bumps WEBKIT_VERSION in scripts/build/deps/webkit.ts from a commit sha to autobuild-preview-pr-417-fbb76610, a preview build of oven-sh/WebKit#417 that fixes a DFG LiveCatchVariablePreservationPhase bug affecting using disposal in optimized code. It also adds two JSC stress fixtures (the fuzzer-shaped validation case and a behavioural SuppressedError check) and wires them into jsc-stress.test.ts.
Security risks
None identified. The change is a dependency version bump plus test fixtures; no auth, crypto, or input-handling code is touched in this repo.
Level of scrutiny
High. Although the local diff is tiny, the effective change is a new JavaScriptCore binary for every platform. The preview build is cut from current WebKit main, so it carries not only the targeted fix but everything between the previous pin (7b763944…) and main — the description calls out oven-sh/WebKit#410 explicitly. Pinning to a preview tag of an unmerged upstream PR (with the description noting the pin "should move to the final autobuild-<sha> once it lands") is a release-process decision that a maintainer should confirm rather than an automated reviewer.
Other factors
- The fixtures follow the existing
jsc-stressconventions:// @bunheader,//@ requireOptions(...)directives thatparseJSCFlagsalready handles, and self-checking viashouldBe/ non-zero exit on failure.--validateGraph=1on the FTL fixture makes it fail on release builds of the unfixed engine, and the behavioural fixture asserts the exactSuppressedErrorshape. - Verified that
prebuiltUrl/prebuiltDestDirinwebkit.tsalready handleautobuild--prefixed version strings, so the tag form of the pin resolves to the correct release URL and cache key without further changes. - The description's verification (fixtures fail under
USE_SYSTEM_BUN=1, pass on the preview build, related ERM/async_hooks suites pass) is thorough, but CI on the actual preview tarball is what proves the wider bump is safe across platforms — that's the part a human should look at before merging.
|
On the pin: the preview tag is only there so CI can exercise the fix before oven-sh/WebKit#417 lands; once it merges this should be re-pointed at the merged main sha, as with previous bumps of this kind. The engine content between the current pin (7b763944) and the preview is #417 itself plus oven-sh/WebKit#410 (InternalFieldTuple cast by JSType); the remaining commits in that range (#411 to #414) only change how the prebuilts are built (line tables only for the -lto variants, extra freebsd/android variants). Any bump that picks up #417 necessarily carries those too. What the preview tarball has shown so far: locally the debug-asan tarball builds and passes jsc-stress (117/117), the explicit resource management, mock-disposable, bun-jsc and async_hooks suites (the last one covers the #410 cast path). The one failure in build 93631 was the x64-musl build step getting a 404 for bun-webkit-linux-amd64-musl-lto.tar.gz: the preview release's last asset upload had stalled, so that lane started before the asset existed. The WebKit release job has been rerun and is re-uploading the assets; I will retrigger CI here once the release is complete. |
|
The preview release is complete now (all 42 tarballs uploaded, including the musl-lto one that 404'd in build 93631), so CI has been retriggered: https://buildkite.com/bun/bun/builds/93640. No code changes since the review above; the new commit is empty. |
|
Status: build 93640's only failure is the linux x64 build-bun step, and it failed fetching the lolhtml source tarball (github.com archive download, "fetch failed" after 5 retries), not anything in this change; the preview WebKit tarball itself downloaded and extracted fine on that agent, and the other platforms' lanes are still running. That step just needs a retry. I am not going to push another empty commit for it; whoever picks this up can retry the step in Buildkite, and I will follow up on anything it turns up. Unchanged from the description: with the preview tarball locally, both new fixtures pass, jsc-stress is 117/117, and the original fuzzer input no longer asserts; both fixtures fail on the engine without oven-sh/WebKit#417. |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs in the diff itself. Because it bumps the WebKit/JavaScriptCore pin — and to a preview tag that the description says should be re-pointed at the merged autobuild-<sha> once oven-sh/WebKit#417 lands — a human should sign off on the engine bump and confirm the final pin before merge.
What was reviewed:
prebuiltUrl/prebuiltDestDirhandle theautobuild--prefixed version string correctly (no double prefix; cache key uses the full tag).- The two new fixtures use
//@ requireOptions(...), whichparseJSCFlagsalready handles, and are wired into thejsFixtureslist. - The behavioural fixture asserts
SuppressedErrorwith both.errorand.suppressedmessages after warming the JIT; the validation fixture relies on--validateGraph=1so it fails on release builds too.
Extended reasoning...
Overview
This PR changes the WEBKIT_VERSION constant in scripts/build/deps/webkit.ts from the SHA 7b763944… to a preview tag autobuild-preview-pr-417-fbb76610, and adds two JSC stress-test fixtures (plus registers them in jsc-stress.test.ts). The actual code fix lives in oven-sh/WebKit#417; this PR is the Bun-side pin bump and regression coverage.
Security risks
None introduced by the diff. The bump pulls a prebuilt tarball from oven-sh/WebKit's own GitHub releases, same mechanism as before. No new user-facing surface, parsing, or auth paths are touched.
Level of scrutiny
High. Although the textual diff is tiny, changing the JavaScriptCore pin swaps out the JS engine for every code path in Bun. The bump also carries oven-sh/WebKit#410 and build-only changes #411–#414 in addition to the targeted #417 fix. Engine bumps are exactly the kind of change where a maintainer should confirm CI is fully green across all lanes and decide whether to land on the preview tag or wait for the merged SHA.
Other factors
- The PR description and the follow-up comment both state the preview pin is temporary and should move to the final
autobuild-<sha>once #417 merges — that's a pending action a human needs to track. - The prior CI run (#93631) had a lane fail on a 404 for a not-yet-uploaded preview asset; the current build (#93640) was retriggered after re-uploading. A human should verify it went green.
- The test additions themselves look correct and follow the existing jsc-stress fixture conventions (
//@ requireOptions,shouldBehelper, megamorphic call-site trick to prevent inlining). No issues found there. - No prior review comments from me on this PR.
|
Nothing new to change from this review; the pin handling and the CI state are covered in the two comments above. For the record on the "verify it went green" point: in build 93640 the only failure is still the linux x64 build step (lolhtml source tarball download), which blocks the 41 x64 test lanes behind it; everything else is proceeding against the preview tarball, 113 jobs passed so far, including test lanes on the x64-asan (assert-enabled engine), alpine and windows builds. The handful of yellow entries so far are timing and GC sensitive tests that passed on retry or alone (test-fs-read-stream-pos, inspect-error-leak, sourcetextmodule-leak, napi GC condition, test-error-code-done-callback), none of them near exception handling or disposal. The x64 build step still just needs a retry in Buildkite. |
ae6e00a to
61a54bd
Compare
|
Rebased onto current main. The WebKit pin had moved five times underneath this branch, so the only conflict was the WEBKIT_VERSION line. oven-sh/WebKit#417 is now rebased onto 0cbb4a19 (main's current pin) and this branch pins its new preview, autobuild-preview-pr-417-bc08a6e1, so the engine delta against main is just that one change; the earlier note about the preview also carrying #410 no longer applies. The empty retrigger commit is gone, the fixtures are unchanged. Re-verified on the rebased branch: both fixtures still assert on the jsc shell from main's current 0cbb4a19 debug-asan prebuilt, and with the new preview |
| * From https://github.com/oven-sh/WebKit releases. | ||
| */ | ||
| export const WEBKIT_VERSION = "0cbb4a194653231955187f9d8a2990d4b4a55266"; | ||
| export const WEBKIT_VERSION = "autobuild-preview-pr-417-bc08a6e1"; |
There was a problem hiding this comment.
🔴 WEBKIT_VERSION is pinned to autobuild-preview-pr-417-bc08a6e1, a preview tag for the unmerged oven-sh/WebKit#417. Per the repo's Dependencies & vendoring rules ("Never merge a pin to an ephemeral artifact (preview tags, unmerged-PR builds)"), this needs to be re-pointed at the merged main commit's autobuild-<sha> — with all 42 platform×flavor tarballs verified present — before this PR lands. The PR description already notes this; flagging so it isn't merged as-is.
Extended reasoning...
What the bug is
scripts/build/deps/webkit.ts:6 sets WEBKIT_VERSION = "autobuild-preview-pr-417-bc08a6e1". This is a preview-build tag published by oven-sh/WebKit's CI for the not-yet-merged PR oven-sh/WebKit#417, not a release tag for a commit on WebKit main.
The repo's own dependency rules in .claude/docs/landing-prs.md:47 (Dependencies & vendoring, referenced from REVIEW.md) state explicitly:
Version bumps are repo-wide, verified operations. Never merge a pin to an ephemeral artifact (preview tags, unmerged-PR builds) — swap to the merged upstream SHA and verify prebuilt artifacts exist for every platform × flavor before merge.
An autobuild-preview-pr-* tag is precisely the "preview tags, unmerged-PR builds" case that rule prohibits merging.
The code path that triggers it
prebuiltUrl() in the same file constructs the download URL from cfg.webkitVersion:
const tag = version.startsWith("autobuild-") ? version : `autobuild-${version}`;
return `https://github.com/oven-sh/WebKit/releases/download/${tag}/${name}.tar.gz`;So every fresh build with cfg.webkit === "prebuilt" (the default for CI and most local builds) fetches from https://github.com/oven-sh/WebKit/releases/download/autobuild-preview-pr-417-bc08a6e1/bun-webkit-<os>-<arch><suffix>.tar.gz. Preview releases are transient by convention — once oven-sh/WebKit#417 merges and gets its own autobuild-<merged-sha> release, the preview release can be (and typically is) cleaned up. At that point every fresh build 404s on the WebKit tarball, and bun bd / CI's build-bun step fails before compilation even starts.
Why nothing prevents it
There is no fallback in source.ts's prebuilt fetch — a 404 on the tarball is a hard build failure (the timeline already shows one lane 404ing on a not-yet-uploaded asset in build 93631). prebuiltDestDir() caches by version string, so machines that already have webkit-preview-pr-417-bc08a6e1<suffix> extracted keep working, which masks the problem locally but leaves every fresh checkout, new CI runner, and cache-cleared machine broken.
Step-by-step proof
- This PR merges with
WEBKIT_VERSION = "autobuild-preview-pr-417-bc08a6e1". - DFG: LiveCatchVariablePreservationPhase flushed the wrong handler's locals when one try range leads directly into another WebKit#417 merges to main; CI publishes
autobuild-<merged-sha>with the same 42 tarballs. - The now-redundant
autobuild-preview-pr-417-bc08a6e1GitHub release is deleted (standard practice for preview tags). - A developer clones bun fresh and runs
bun bd, or a CI runner starts with an empty cache. prebuiltUrl()returns.../autobuild-preview-pr-417-bc08a6e1/bun-webkit-linux-amd64-lto.tar.gz→ 404.- Build fails at the "fetch WebKit" step. Every platform × flavor is affected.
Impact
Merging as-is puts main one preview-release deletion away from being unbuildable from a clean checkout. The author has already acknowledged this in both the PR description ("the pin should move to the final autobuild-<sha> once it lands on WebKit main") and the timeline ("once it merges this should be re-pointed at the merged main sha"), so this is not a disagreement about the fix — it is the repo-mandated gate that must be satisfied before merge.
How to fix
Wait for oven-sh/WebKit#417 to land on main, then replace this line with the merged commit's 40-hex SHA (e.g. export const WEBKIT_VERSION = "<merged-sha>";) and confirm all 42 tarballs (os × arch × {musl,android,freebsd} × {debug,lto,asan}) exist under the corresponding autobuild-<sha> release before merging this PR.
|
Agreed, and that matches the plan in the description: the preview pin exists so CI can exercise the fix, it must not land. To make that explicit I have converted this PR to a draft. Once oven-sh/WebKit#417 merges I will re-point WEBKIT_VERSION at the merged commit's autobuild- release, check that all 42 tarballs are present in it (the same list the preview release has), and mark the PR ready. The version only lives in scripts/build/deps/webkit.ts on this branch (git grep finds no other copy of the current pin), so that swap is the one line. |
|
A second fuzzer input landed on the same fingerprint (same phase, same Pushed c507330 with a small deterministic version of that shape as a third fixture, |
c507330 to
298e421
Compare
|
Rebased again: main moved its pin to c6cfe90c (#39368), so the only conflict was the WEBKIT_VERSION line once more. oven-sh/WebKit#417 is now rebased onto c6cfe90c and this branch pins its new preview, autobuild-preview-pr-417-9984a386 (all 42 tarballs present), so the engine delta against main is still just that one change. With it, |
|
A third fuzzer input came in on the same fingerprint. It is the eval shape again: const v3 = { [Symbol.dispose]() {} };
for (using v5 of [v3]) {
try { SharedArrayBuffer.call(); } catch (e) {}
}
let v12 = new Int8Array(51)[44];
v12++;
while (v12) {} // never ends; this is what tiers the eval code up to the FTLThat is the shape CI for the rebased head (298e421) passed: build 99684, 179/179. Still a draft until oven-sh/WebKit#417 lands and the pin can move to the merged sha. |
|
Main moved its pin to eeab0404 (#39371, the upstream merge), so the WEBKIT_VERSION line conflicts again. The bug is still there in that engine: all three fixtures assert on the jsc shell from the eeab0404 debug-asan prebuilt, and the phase itself did not change in the upstream range (the file is byte-identical between c6cfe90c and eeab0404), so oven-sh/WebKit#417 is still needed. It is now rebased onto eeab0404 (same patch, head ece09c13) and its preview build is running. This branch is rebased locally onto current main with the pin pointing at that preview; I will push it once the preview release has all of its tarballs, so CI does not run against a half-uploaded release like it did in build 93631. |
298e421 to
db1e4fe
Compare
|
Pushed the rebase (db1e4fe). The preview for the rebased oven-sh/WebKit#417 is autobuild-preview-pr-417-ece09c13, built on eeab0404, and all 42 tarballs are in the release (one of its runner-side builds and then the last asset upload needed a rerun, which is why this took a while). This branch is still the same two commits, only the pin line changed in the conflict resolution. With that preview, |
|
Main's pin moved again, to 0f966e81 (#39614), so the WEBKIT_VERSION line conflicts once more. The fix is still needed there: the three fixtures assert on the jsc shell from the 0f966e81 debug-asan prebuilt (loc12, loc21, loc12 as before), and none of the four fork commits between eeab0404 and 0f966e81 touch the phase or the stress tests. oven-sh/WebKit#417 is rebased onto 0f966e81 (same patch, head ee07b022) and its preview build is running. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
db1e4fe to
bf2eecb
Compare
|
Pushed the rebase (bf2eecb). The pin is now autobuild-preview-pr-417-ee07b022, which is oven-sh/WebKit#417 rebased onto 0f966e81 (main's current pin); its release has the same 42 tarballs as main's own 0f966e81 release. The preview took a few reruns to get through, the fork's preview builds were failing for every branch this morning during the Docker image setup (apt mirror and LLVM install, see oven-sh/WebKit#473), including two runs dispatched on the fork's main itself, so that was not related to this patch. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
Main's pin moved to b7f217b4 (#39829), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the b7f217b4 debug-asan prebuilt (loc12, loc21, loc12), and the one fork commit since 0f966e81 only touches the FTL FFI lowering. oven-sh/WebKit#417 is rebased onto b7f217b4 (same patch, head 59fa7dae) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
bf2eecb to
9e4f46e
Compare
|
Pushed the rebase (9e4f46e). The pin is now autobuild-preview-pr-417-59fa7dae, which is oven-sh/WebKit#417 rebased onto b7f217b4 (main's current pin); its release has the same 42 tarballs as main's own b7f217b4 release. The preview needed four attempts: the fork's image setup step is still flaky (oven-sh/WebKit#473 is still open), and with fail-fast one early failure cancels the rest of the group, so each attempt either gets all of the remaining jobs through or none of them. The branch is still the same two commits, only the pin line changed in the conflict resolution. With this preview, |
|
A fourth fuzzer input landed on this fingerprint (found on cfa9f8e, which pins 0f966e81). It is the same eval shape as the first and third ones, |
|
Main's pin moved to aea1f010 (#35343, the Buffer accessor intrinsics via oven-sh/WebKit#330), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the aea1f010 debug-asan prebuilt (loc12, loc21, loc12), and none of the fork commits since b7f217b4 touch the phase. oven-sh/WebKit#417 is rebased onto aea1f010 (same patch, head 191bbb7d) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
|
Main's pin moved to 0bb01ed5 (#40643), which also brings in the fork's Windows arm64 CI fix, so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the 0bb01ed5 debug-asan prebuilt (loc12, loc21, loc12); the fork commits since 72597399 are module loader work and the CI fix, nothing in the DFG. oven-sh/WebKit#417 is rebased onto 0bb01ed5 as a single commit again (head 79dfb46e, the stacked CI copy is gone) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
01ab140 to
2a24aa6
Compare
|
Pushed the rebase (2a24aa6). The pin is now autobuild-preview-pr-417-79dfb46e, which is oven-sh/WebKit#417 rebased onto 0bb01ed5 (main's current pin) as a single commit again, the stacked CI copy is gone since the fork's main now has that fix. Its release has the same 42 tarballs as main's own 0bb01ed5 release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
Main's pin moved to 1817c3c3 (#40681, the upstream upgrade to 6b879687ee), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the 1817c3c3 debug-asan prebuilt (loc12, loc21, loc12). The upstream range changes the FTL OSR exit encoding and a few DFG phases, but not the catch handling, the using disposal emission or this phase (the file is byte-identical). oven-sh/WebKit#417 is rebased onto 1817c3c3 (same patch, head 6654f96e) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
2a24aa6 to
d7c74ad
Compare
|
Pushed the rebase (d7c74ad). The pin is now autobuild-preview-pr-417-6654f96e, which is oven-sh/WebKit#417 rebased onto 1817c3c3 (main's current pin, the upstream upgrade); its release has the same 42 tarballs as main's own 1817c3c3 release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
CI state for d7c74ad (build 107555): 179 of 182 jobs passed. The three failed jobs are not about this change. The darwin aarch64 test job died before running any test (buildkite-agent artifact download timed out after 120s), and darwin x64 failed |
|
Main's pin moved to ceb9f90f (#40767 and #40677, bytecode cache work plus the IRO ArithAbs fix), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the ceb9f90f debug-asan prebuilt (loc12, loc21, loc12); the only DFG file in the range is DFGIntegerRangeOptimizationPhase, the phase here is unchanged. oven-sh/WebKit#417 is rebased onto ceb9f90f (same patch, head adefab25) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
d7c74ad to
8604325
Compare
|
Pushed the rebase (8604325). The pin is now autobuild-preview-pr-417-adefab25, which is oven-sh/WebKit#417 rebased onto ceb9f90f (main's current pin); its release has the same 42 tarballs as main's own ceb9f90f release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
An eighth fuzzer input landed on this fingerprint (found on d9b7698, pin d71031a9, marked flaky). The crash output in the report has the same shape as the other seven: an FTL compile of a function with Main's pin moved to d71031a9 (#40816, the initial GC budget for compiled executables), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the d71031a9 debug-asan prebuilt (loc12, loc21, loc12); the three fork commits since ceb9f90f touch only the Heap budget, nothing in the DFG. oven-sh/WebKit#417 is rebased onto d71031a9 (same patch, head f5d2f3a7) and its preview build is running. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
8604325 to
ab04e07
Compare
|
Pushed the rebase (ab04e07). The pin is now autobuild-preview-pr-417-f5d2f3a7, which is oven-sh/WebKit#417 rebased onto d71031a9 (main's current pin); its release has the same 42 tarballs as main's own d71031a9 release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
A ninth fuzzer input landed on this fingerprint (found on d296efb, pin d4e7e206, marked flaky). Same bug, a function shape this time: a constructor Main's pin moved to 2e2aa229 (#41297, #41324, the upstream upgrade in #41332, #41378 and #41407), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the 2e2aa229 debug-asan prebuilt (loc12, loc21, loc12). The upstream range touches DFGOSRAvailabilityAnalysisPhase only for LoadVarargs heap kills; DFGLiveCatchVariablePreservationPhase and the bytecompiler are byte-identical. oven-sh/WebKit#417 is rebased onto 2e2aa229 (same patch, head dfddac7d) and its preview build is queued. This branch is rebased locally with the pin pointing at that preview; I will push once the release has all 42 tarballs. |
ab04e07 to
15c3d97
Compare
|
Pushed the rebase (15c3d97). The pin is now autobuild-preview-pr-417-dfddac7d, which is oven-sh/WebKit#417 rebased onto 2e2aa229 (main's current pin); its release has the same 42 tarballs as main's own 2e2aa229 release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
A tenth fuzzer input landed on this fingerprint (found on d316760, pin 2e2aa229, deterministic). It is the first shape again, almost literally the State is otherwise unchanged: head 15c3d97 sits on current main (pin 2e2aa229, no conflict), build 110361 passed 181/181, and this stays a draft until oven-sh/WebKit#417 merges. |
|
An eleventh fuzzer input landed on this fingerprint (found on d316760, pin 2e2aa229, deterministic). Same eval shape as the tenth and the first: |
…ized code DFG's LiveCatchVariablePreservationPhase flushed the locals of the handler being entered instead of the handler being left when one try range led directly into another. The dispose call emitted for a `using` block ends its synthesized catch range right at the call, inside the enclosing handler, so the "body threw" flag that only the synthesized catch reads was never flushed. FTL compiles of such code failed OSR availability validation, and optimized code restored the flag as undefined when a dispose method threw after the body threw, dropping the body's error instead of reporting a SuppressedError. Pins oven-sh/WebKit#417's preview build and adds both shapes as jsc-stress fixtures.
…fixture A second fuzzer input hit the same assertion with the dispose method inlined into the dispose call (the method is trivial, so inlining does not split the block) and the function reached through recursion. The original input does quadratic work, so this is a small deterministic version of that shape; it fails OSR availability validation on the unfixed engine and passes with the fix.
|
A twelfth fuzzer input landed on this fingerprint (found on 4ff9193, pin dfd69644, marked flaky). Same eval shape as the tenth and eleventh: Main's pin moved to cf1b36ec (#42002, then the upstream upgrade in #42319), so the WEBKIT_VERSION line conflicts again. Still needed there: the three fixtures assert on the jsc shell from the cf1b36ec debug-asan prebuilt (loc12, loc21, loc12). DFGLiveCatchVariablePreservationPhase is byte-identical across 2e2aa229, dfd69644 and cf1b36ec, and the bytecompiler changes in the range do not touch the |
15c3d97 to
eaf28d4
Compare
|
Pushed the rebase (eaf28d4). The pin is now autobuild-preview-pr-417-db6d1d70, which is oven-sh/WebKit#417 rebased onto cf1b36ec (main's current pin); its release has the same 42 tarballs as main's own cf1b36ec release and the preview built on the first attempt. The branch is still the same two commits; only the pin line changed in the conflict resolution. With this preview, |
|
CI state for eaf28d4 (build 114339): 180 of 181 jobs passed. The failed job is the Windows 2019 x64 test lane. There, |
…e try range runs into the next (oven-sh/WebKit#629) (#42787) ### What this fixes In DFG-compiled code, a local that is live only at the head of a `catch` handler came back as `undefined` after an exception whenever that handler's try range was followed *directly* by another one. Two ways to get that bytecode layout: **`bun build --bytecode` (regression from #42002).** The bytecode optimizer deletes the `jmp` that closes a try body once an empty `catch {}` has been threaded to the loop header, so the catch's range falls through into the next one. This then breaks after tier-up: ```js function f(kind) { for (let name of ["a", "b"]) { try { return JSON.parse(kind === "k" && name === "b" ? "1" : "{bad"), true; } catch {} } return false; } // TypeError: undefined is not a function (near '...name of ["a", "b"]...') ``` It is not specific to for-of or to `JSON.parse`: a `while (true)` inside `try … finally`, or a labelled `break` into code that starts with a `try`, loses whatever only the loop uses, and when that is a number nothing throws — a loop-only `doubled` silently became `NaN`. Building with `--no-optimize-bytecode` / `optimize: { bytecode: false }` avoided it. **`using` (not a regression, all bytecode).** The dispose call's synthesized catch range ends right at the call, inside the enclosing handler's range. A dispose method that threw after the body also threw reported its own `Error` instead of a `SuppressedError` carrying both, once the function was optimized. ### Cause and fix (oven-sh/WebKit#629) `DFG::LiveCatchVariablePreservationPhase` flushes, when the covering exception handler changes, every local live at the catch head of the handler being left. The lookup of the *new* handler overwrote that live set before the flush ran, so a direct A → B transition flushed B's set for A. Locals live only at A's catch were then dead in the block, and the exception OSR exit to A's `op_catch` recovered them as `undefined`. Stock `try`/`catch` always ends a range with an explicit `jmp`, so only the two layouts above reach it. The phase now looks the handler up, flushes with the old set, and only then computes the new one, keyed on (handler, inline call frame) so recursive inlining keeps following the frame. The fixing line is the reordering in `handleBlockForTryCatch`; everything else in that diff is the lookup returning the pair. ### Also in this WebKit range `9b02218df662..65513e295c73`: oven-sh/WebKit#657 (suspended generators keep their scopes' SymbolTables), #658 (MicrotaskCallCache over zeroed storage), #583 (no weak `Bun__thisThreadHasVM` fallback — bun defines it in `VirtualMachine.rs`), #627 (`JSModuleLoader::clearAll()` in one pass), #624 (DFG constant-folding a module variable across an import cycle). ### Tests - `test/bundler/bun-build-compile.test.ts` → `locals live only at a catch inside a loop`: builds a fixture with `bun build --bytecode` and runs it; covers for-of (result discarded and used), `while` inside a user `finally`, labelled `break` into a `try`, the loop-only number that turns into `NaN`, the for-of inlined into a caller, and a recursively inlined try/catch on source (that last one is a no-regression check for the inline-frame keying, it passes before too). JIT thresholds are lowered in the child's environment so DFG is reached after ~100 calls; every case goes wrong within 70 iterations on the unfixed engine and the test runs 300. - `test/js/web/explicit-resource-management.test.ts` → `a dispose that throws after the body threw reports a SuppressedError from optimized code`. On `1.4.3-canary.1+7e56b402b` (unfixed): the two `--bytecode` cases fail (`loopOnlyNumber: got false:4:NaN`, `TypeError: undefined is not a function`) and the `using` test prints `Error | undefined | undefined`. With this PR (`bun bd test`, debug build on the published prebuilt) all of them pass. They pass on 1.4.2 as well for the `--bytecode` part, since that predates the optimizer. Supersedes #37941, which pinned a preview build of an earlier, now closed, version of the same engine fix (oven-sh/WebKit#417).
|
Superseded by #42787. |
Found by fuzzing. Fingerprint:
DFGOSRAvailabilityAnalysisPhase.cpp(198).Problem
Reduced fuzzer input, run through indirect eval (that is how the REPRL harness evaluates scripts; a plain function with a
usingblock hits the same thing once it reaches the FTL, see the second fixture):Debug/ASAN builds abort when the FTL compiles it:
loc21is thehasError("the body threw") flag of the disposal code the bytecode generator emits forusing. Release builds do not abort, they miscompile: once a function containing ausingblock is optimized (the DFG tier is enough; the dispose call just has to remain a real call instead of being inlined), a dispose method that throws after the body also threw comes out as the dispose method's plainErrorinstead of aSuppressedErrorholding both errors, so the body's exception is silently dropped. On a release build of the unfixed engine (the phase in question is identical from the build I used through main's current pin and WebKit main):Cause
DFG's
LiveCatchVariablePreservationPhasekeeps the locals a catch handler reads alive by insertingFlushes: in front ofSetLocals inside a try range, and whenever a block's nodes cross from one handler's range into a different one (plus at the end of the block). The handler lookup it uses to detect "the handler changed" also overwrote its cached live-at-catch set with the liveness of the handler it had just found, before the flush for the handler being left was emitted, so a transition straight from one handler into another flushed the wrong handler's locals. Plaintry/catchnever crosses handlers inside a block becauseTryNodeemits its jump over the catch block inside the try range. Theusingdisposal code ends the synthesized catch's range right after the dispose call, at a label, so the block ends there as well and its terminal carries the origin of the next bytecode, which belongs to the enclosing handler (the for-of's synthesized finally here, the user'stry/catchin the function case).hasErroris only read by that synthesized catch, so with the flush missing nothing keeps it alive across the merge where it is eitherfalseortrue; it is unavailable at the dispose call's exception exit, the exit restores it asundefined, and the catch treats that as "no pending error".Fix
oven-sh/WebKit#417: flush for the handler being left first, then compute the liveness of the handler being entered. That PR is rebased onto WebKit
cf1b36ec, which is exactly what main pins today (none of the upstream merges in #39371, #40276, #40681, #41332 and #42319 nor the fork commits in between touch this phase), so its preview build (autobuild-preview-pr-417-db6d1d70, the pin in this PR) is main's engine plus that one change. The pin should move to the finalautobuild-<sha>once #417 lands.Fixtures in
test/js/bun/jsc-stress:for-using-dispose-call-live-catch-locals-ftl-validation.jsis the first fuzzer shape (eval, dispose call not inlined) andusing-inlined-dispose-live-catch-locals-ftl-validation.jsis a small deterministic version of a second fuzzer input that hit the same assertion with the dispose method inlined into the call and the function reached through recursion; both run with--validateGraph=1, so they fail on release builds of the unfixed engine too.using-dispose-throw-after-body-throw-in-jit.jschecks theSuppressedErrorbehaviour once the function is optimized. The first and third of these are also in the WebKit PR as stress tests.Verification
jscshell shipped in the0cbb4a19debug-asan prebuilt (main pinned that when the evidence was gathered) and on the shell from today's pincf1b36ec(loc12in the function shapes,loc21in the eval shape), the two validation fixtures also fail through the harness withUSE_SYSTEM_BUN=1, and the behaviour fixture returns the wrong result on a release build of the unfixed engine. The second fuzzer input itself asserts on the unfixed engine within its first FTL compile.bun bdagainst the preview tarball, on this branch rebased onto current main: all three fixtures pass,jsc-stress.test.tsis 117/117 before the third fixture was added, and both fuzzer inputs no longer assert (the second one completes the FTL compile that used to fail; the input itself then runs for minutes even on a release build because it recurses to stack overflow from every level of another recursion). The preview's ownjscshell passes the fixtures as well. (Before the rebase, the earlier preview also passedtest/js/web/explicit-resource-management.test.ts,test/js/bun/test/mock-disposable.test.ts,test/js/bun/resolve/lower-using-bun-target.test.ts,test/js/bun/jsc/bun-jsc.test.tsandtest/js/node/async_hooks.)SuppressedErrorscenario matches the interpreter at both the DFG and FTL tiers with the fix.Rebased onto main eighteen times as the WebKit pin moved underneath (the upstream merge in #39371, then #39614, #39829, #35343, #40201, the upstream merge in #40276, #40417, #40507, #40570, #40270, #40643, the upstream merge in #40681, #40767, #40816, the group #41297, #41324, the upstream merge in #41332, #41378 and #41407, and then #42002 with the upstream merge in #42319); each time the only conflict was the
WEBKIT_VERSIONline, resolved to the preview built on top of the new pin. Latest: previewdb6d1d70oncf1b36ec, jsc-stress 119/119 with it, and the three fixtures still fail on thecf1b36ecshell.[policy-decision:webkit] gate passed · iteration 9 · 5 files touched
passes on PR (with fix)
diff hotspot
gate history · 20 passed · 0 rejected · iteration 9
evidence per changed file