Skip to content

ci: add linux aarch64 ASAN build and test lanes to PR pipelines - #31699

Open
robobun wants to merge 9 commits into
mainfrom
farm/3977ed4f/linux-arm64-asan-ci
Open

ci: add linux aarch64 ASAN build and test lanes to PR pipelines#31699
robobun wants to merge 9 commits into
mainfrom
farm/3977ed4f/linux-arm64-asan-ci

Conversation

@robobun

@robobun robobun commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a linux aarch64 ASAN (glibc) build + test lane to Buildkite, mirroring the existing linux x64 ASAN lane. PRs now get ASAN coverage on both Linux architectures.

  • buildPlatforms += { os: linux, arch: aarch64, profile: asan } (amazonlinux 2023, same image as the other linux build lanes)
  • testPlatforms += { os: linux, arch: aarch64, profile: asan } (debian 13, 20 shards, 45 min timeout, same ASAN_OPTIONS as x64-asan)
  • needsBaselineVerification() now skips profile === "asan"

Like x64-asan, the new lane is PR-only: both getPipelineOptions() and the includeASAN check in getPipeline() already filter asan profiles on the main branch, and asan artifacts are already excluded from the release and binary-size steps.

Why the needsBaselineVerification change

Without it, the new lane would inherit a verify-baseline step (the check matches all linux-aarch64 targets). That step downloads ${triplet}-profile.zip, but asan link steps upload ${triplet}-asan.zip (see the zip contract in scripts/build/ci.ts), so the step would fail on artifact download — and it would also try to run an ASAN-instrumented binary under qemu-user. ASAN builds are PR-only test artifacts that never ship; instruction-policy verification stays on the release lanes.

What was already in place

The rest of the plumbing is profile/arch-generic and needed no changes:

  • getTestAgent() already had an aarch64+asan branch (r8g.2xlarge for ASAN shadow-memory headroom)
  • getRustAgent() already sizes up to r8g.4xlarge for asan
  • packaging (scripts/build/ci.ts) derives bun-linux-aarch64-asan.zip from config
  • runner.node.mjs keys its ASAN timeout bump off -asan- in the step name, and the test harness detects ASAN via a runtime probe
  • the WebKit release-asan prebuilt for this target (bun-webkit-linux-arm64-asan.tar.gz) exists at the pinned WEBKIT_VERSION

Verification

  • Generated the pipeline locally on a PR-like branch: exactly one new group (linux-aarch64-asan: build-cpp → build-rust → build-bun → test-bun) appears; full-content diff against the pre-change pipeline shows no other step changed, and all existing verify-baseline steps remain.
  • Generated the pipeline as the main branch: zero asan steps (both arches filtered).
  • Cross-compiled the rust step locally with --profile=ci-rust-only --os=linux --arch=aarch64 --abi=gnu --asan=on (the same cross-compile CI performs): builds clean; the resulting libbun_rust.a objects are ELF 64-bit ARM aarch64 with __asan_init/__asan_globals_registered symbols, confirming instrumented std via -Zsanitizer=address.
  • The cpp/link halves run natively on aarch64 and are exercised end-to-end by this PR's own CI, since Buildkite generates the pipeline from this branch's ci.mjs — the new lane runs on this very PR.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@robobun, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 26 minutes and 17 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7ed86fcb-8494-4bef-b90f-813c3bfaa110

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1803a and 212daf8.

📒 Files selected for processing (10)
  • .buildkite/ci.mjs
  • src/runtime/bake/DevServer.rs
  • src/runtime/bake/DevServer/ErrorReportRequest.rs
  • src/runtime/server/FileRoute.rs
  • src/runtime/server/NodeHTTPResponse.rs
  • src/runtime/server/RequestContext.rs
  • src/runtime/server/StaticRoute.rs
  • src/runtime/server/mod.rs
  • src/runtime/server/server_body.rs
  • test/js/bun/http/serve.test.ts

Walkthrough

Refactors cached-bytecode ownership between Rust and C++, fixes VM/server shutdown and resource-drop ordering, adds Linux aarch64 ASAN CI lanes (skipping baseline verification for ASAN), and bumps the WebKit prebuilt version.

Changes

Bytecode Ownership & Shutdown Cleanup

Layer / File(s) Summary
Bytecode cache FFI struct and ownership flag
src/jsc/ResolvedSource.rs, src/jsc/bindings/headers-handwritten.h
ResolvedSource gains a bytecode_cache_needs_deref boolean field in the repr(C) contract; Rust Default sets it false and OwnedResolvedSource Drop conditionally frees heap-transferred bytecode.
Heap bytecode transfer at transpilation
src/jsc/RuntimeTranspilerStore.rs, src/jsc/ResolvedSource.rs, src/runtime/jsc_hooks.rs
Transpiler takes ownership of already_bundled bytecode, converts it to a raw heap buffer via heap::into_raw, sets bytecode_cache/bytecode_cache_size and bytecode_cache_needs_deref; Rust frees only on error before C++ wrappers take ownership.
C++ bytecode destructor and cleanup
src/jsc/bindings/ZigSourceProvider.cpp
SourceProvider::create selects CachedBytecode destructor based on bytecode_cache_needs_deref, clears the flag after wrapping, and documents ownership semantics to avoid double-free or leaks.
VM cron cleanup shutdown ordering
src/jsc/VirtualMachine.rs
Reorders VirtualMachine::destroy to call cron_clear_all_teardown before taking rare_data, ensuring cron hooks run while VM state exists.
Server synchronous shutdown on VM teardown
src/runtime/server/mod.rs
NewServer::schedule_deinit detects vm.is_shutting_down() and synchronously sets TERMINATED, closes uWS App handle (if any), calls deinit immediately, and returns without enqueueing deferred tasks.
Callback and resource cleanup guards
src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp, src/runtime/bake/DevServer.rs, src/watcher/Watcher.rs
Socket onData avoids JS allocation/task posting during final GC; DevServer explicitly derefs HTML bundle refcounts; Watcher drops watchlist elements before reclamation and clears evicted file_path to prevent Cow::Owned leaks.
Watcher file_path mutable column accessor
src/watcher/Watcher.rs
Adds items_file_path_mut() to WatchItemColumns and implements it for WatchList and Slice<WatchItem> to support eviction-time mem::take cleanup.

CI Infrastructure & Dependencies

Layer / File(s) Summary
ASAN build and test platform lanes
.buildkite/ci.mjs
Adds Linux aarch64 entries to buildPlatforms and testPlatforms with profile: "asan", and updates needsBaselineVerification() to return false for ASAN profiles so verify-baseline is skipped.
WebKit prebuilt version bump
scripts/build/deps/webkit.ts
Updates WEBKIT_VERSION constant to a new commit hash for prebuilt artifact download and caching identity.

HTTP response metadata change

Layer / File(s) Summary
AsyncHTTP returns metadata and Deref impl
src/http/AsyncHTTP.rs, src/http/lib.rs
AsyncHTTP::send_sync now returns HTTPResponseMetadata and clears caller real.response to avoid aliasing; HTTPResponseMetadata implements Deref<Target = bun_picohttp::Response<'static>> to allow transparent response access.

Minor comments and tests

Layer / File(s) Summary
HTML bundle Drop and safety comments
src/runtime/server/HTMLBundle.rs, src/runtime/server/server_body.rs
Explicitly deref bundle in Route Drop and update safety/refcount comment for AnyRoute::html_route_from_js.
ASAN-aware test timeout
test/js/workerd/html-rewriter-leak.test.ts
Test imports isASAN and uses isASAN ? 90_000 : 15_000 timeout to account for slower ASAN runs.
Windows baseline allowlist
scripts/verify-baseline-static/allowlist-x64-windows.txt
Expanded strpbrk allowlist features to include RTM and replaced the inline comment with detailed rationale.

Possibly related PRs

Suggested reviewers

  • Jarred-Sumner
  • alii
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a linux aarch64 ASAN build and test lane to CI pipelines.
Description check ✅ Passed The description comprehensively covers what the PR does, why changes were made, and how verification was performed, exceeding template requirements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the claude label Jun 2, 2026
@robobun

robobun commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 4:46 PM PT - Jun 3rd, 2026

@robobun, your commit 212daf8 has 1 failures in Build #60069 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 31699

That installs a local version of the PR into your bun-31699 executable, so you can run:

bun-31699 --bun

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't find any issues with the code — it cleanly mirrors the x64 ASAN lane and the needsBaselineVerification guard is correct — but adding a 20-shard r8g.2xlarge test lane plus build steps to every PR is a CI capacity/cost decision worth a human sign-off.

Extended reasoning...

Overview

This PR adds a linux-aarch64 ASAN build+test lane to the Buildkite pipeline by appending one entry each to buildPlatforms and testPlatforms in .buildkite/ci.mjs, and adds an early profile === "asan" return to needsBaselineVerification(). The new entries are exact mirrors of the existing linux-x64 ASAN entries with arch swapped to aarch64.

Security risks

None. This is CI pipeline configuration only — no auth, secrets handling, or release-artifact paths are touched. ASAN lanes are already filtered out on main and excluded from release/binary-size steps, so the new lane cannot affect shipped artifacts.

Level of scrutiny

The code change itself is low-risk and mechanically correct: the supporting plumbing (getTestAgent aarch64+asan → r8g.2xlarge, getRustAgent asan → r8g.4xlarge, main-branch ASAN filtering, release/binary-size exclusion) was already in place, and the needsBaselineVerification guard is necessary and correctly scoped — linux-aarch64 unconditionally triggered verify-baseline, which would download a -profile.zip that ASAN link steps don't produce. The previous x64 ASAN lane never hit this because linux-x64 only verifies when baseline is set.

Other factors

The reason I'm deferring rather than approving is not correctness but scope: this adds ~20 r8g.2xlarge test shards (45 min timeout) plus c8g.4xlarge/r8g.4xlarge/r8g.2xlarge build agents to every PR build. That's a meaningful recurring infrastructure cost and fleet-capacity commitment that a maintainer should explicitly green-light, even though the implementation is sound and self-verifying (the lane runs on this PR's own CI).

@robobun

robobun commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

Status: blocked on oven-sh/WebKit#247 — marking draft until a fixed WebKit prebuilt is pinned.

The first run of the new lane (build 59814) proved the pipeline itself: build-cpp, build-rust, and the bun-asan link all succeeded on aarch64, and the artifact flow works. The failure is in the link step's packaging phase, where the freshly linked binary runs features.mjs — its first real JS execution — and dies in prebuilt JSC code:

ASSERTION FAILED: intervalEnd - intervalStart < (ptrdiff_t)(16 * KB)
JavaScriptCore/FreeListInlines.h(63) : JSC::FreeList::forEach (from MarkedBlock.cpp:231, stopAllocating)

Root cause (a latent JSC bug, not a pipeline bug): on Linux ARM64, CeilingOnPageSize is 64 KB (PageBlock.h — page size unknowable at compile time there, e.g. RHEL uses 64 KiB pages), so MarkedBlock::blockSize is 64 KB instead of 16 KB. A swept empty block has a single free interval spanning its whole ~63 KB payload, which trips FreeList::forEach's hardcoded 16 KB assert at the first GC stop. The assert only exists in ASSERT_ENABLED builds — i.e. every -asan/-debug arm64-linux WebKit prebuilt — and nothing ever consumed those artifacts until this lane, so it went unnoticed. macOS arm64 (16 KB ceiling) and linux x64 (16 KB blocks, payload < 16 KB) can mathematically never hit it. The same stale bound exists in upstream WebKit.

Fix: oven-sh/WebKit#247 bounds the assert by MarkedBlock::blockSize (identical check on all currently-green platforms). Once that merges and the autobuild-* release exists, I'll bump WEBKIT_VERSION here and re-run — the lane then exercises the fixed -asan arm64 prebuilt against the full test suite.

@robobun
robobun marked this pull request as draft June 2, 2026 04:53
@robobun
robobun force-pushed the farm/3977ed4f/linux-arm64-asan-ci branch from 62a8f6e to 2edbb2a Compare June 2, 2026 04:54
@robobun
robobun marked this pull request as ready for review June 2, 2026 06:53
@robobun

robobun commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

✅ All review feedback addressed, conflicts resolved, all review threads resolved. Ready for a maintainer.

  • Stacked Borrows UB in schedule_deinit (Jarred's "@robobun fix"): fixed in 1014e9edeinit_if_we_can / schedule_deinit / on_request_complete / on_static_request_complete (plus the ServerLike trait method and AnyServer dispatch) thread this: *mut Self with scoped reborrows, so the shutdown-path synchronous free never deallocates under a protected &mut self frame (borrow = ptr, same shape as Watcher::thread_main). Exit-teardown tests added to serve.test.ts.
  • Follow-up (same class, Box<DevServer> allocation): fixed in 212daf8AnyServer::{on_request_complete, on_static_request_complete} take self by value (Copy); call sites copy the handle out instead of holding &mut into the box deinit_if_we_can drops.
  • Merge conflict: took main's WEBKIT_VERSION = 6d586e29… (Upgrade WebKit to 6d586e29 #31724) — descendant pin; its release has bun-webkit-linux-arm64-asan.tar.gz.
  • Bonus: hasWebKitChanges() repointed from the deleted SetupWebKit.cmake to scripts/build/deps/webkit.ts (12f5956).

CI status (build 60069): every lane that runs this diff is green — including the new linux-aarch64-asan lane (the PR's purpose) and all server test shards. The sole failure is darwin-14-aarch64-test-bun: after four agent-pool expiries it finally ran and failed on exactly one test, test/cli/install/bunx.test.ts"should handle package that requires node 24" (bunx --bun @angular/cli@latest against the live registry). That same test is failing identically on unrelated PRs right now (e.g. build 60200 farm/bde148e1/…; darwin-14 exit-2 failures appear on builds 60184–60200 across branches) — a fresh @angular/cli release broke this registry-dependent test fleet-wide, unrelated to this diff. Needs a maintainer to quarantine/fix that test on main (or merge past it).

Comment thread scripts/build/deps/webkit.ts Outdated
robobun added 2 commits June 2, 2026 07:21
Mirrors the existing linux x64 ASAN lane: release-asan build on
amazonlinux 2023 (aarch64) plus a 20-shard test step on debian 13.
Like x64-asan, the lane is PR-only — filtered out on the main branch.

Skip baseline verification for asan profiles: asan link steps upload
${triplet}-asan.zip, not the ${triplet}-profile.zip that step downloads,
and asan artifacts never ship in releases.
Picks up oven-sh/WebKit#247: FreeList::forEach asserted a hardcoded
16 KB interval bound, but MarkedBlock::blockSize is 64 KB on Linux
ARM64 (CeilingOnPageSize), so every ASSERT_ENABLED arm64-linux
artifact (-asan, -debug, -debug-asan) crashed at the first GC stop.
The new linux-aarch64-asan lane needs the fixed -asan prebuilt.

Also picks up from oven-sh/WebKit main: xwin 0.9.0, UB fix in
double-to-int conversions, JIT disassembler compiled out of release,
windows amd64-baseline ThinLTO variant.
@Jarred-Sumner
Jarred-Sumner force-pushed the farm/3977ed4f/linux-arm64-asan-ci branch from 01c1d50 to daf118d Compare June 2, 2026 07:21
Covers four leak groups across the runtime:

- Bytecode cache (transpiler/module loader): the sidecar .jsc buffer read
  for '// @Bun @bytecode' modules was never freed. The CachedBytecode
  destructor was selected off ResolvedSource.needsDeref, which tracks the
  source_code string and is cleared (and externally mutated) before the
  selection ran, so the no-op destructor was always chosen. Add a dedicated
  bytecode_cache_needs_deref flag (Rust + C++ struct mirror), set it at the
  two heap::into_raw producer sites, key the destructor off it, clear it
  once CachedBytecode adopts the buffer, and free the buffer in
  OwnedResolvedSource::drop when ownership never crossed FFI. Also fixes the
  async RuntimeTranspilerStore path passing a pointer borrowed from a local
  parse_result (dangling by the time the JS thread used it) by transferring
  ownership instead. Embedded bun build --compile bytecode keeps the no-op
  destructor (flag stays false).

- Bun.serve teardown: a server finalized during VM shutdown enqueued its
  App.close + deinit task pair on an event loop that never ticks again;
  EventLoop::deinit freed the tasks unrun and the entire server graph
  (NewServer box, ServerConfig strings, routes, HTMLBundle routes) leaked.
  Run close + deinit synchronously when the VM is shutting down, preserving
  close-before-destroy ordering. Guard JSNodeHTTPServerSocket::onData
  against allocating JS cells during shutdown, mirroring onClose.

- Dev server route bundles: DevServer::drop released client_bundle and
  cached_response but not the intrusive ref RouteBundle holds on its
  html_bundle route (raw pointer, so Vec drop could not release it),
  leaking one HTMLBundleRoute per bundled route. Mirror Zig's
  RouteBundle.deinit and deref it.

- Watcher: WatchItem.file_path is an owning Cow column in a MultiArrayList
  whose Drop is slab-only, so owned paths leaked at watcher teardown and on
  every eviction (swap_remove is a bitwise overwrite). Drop the rows before
  freeing the slab and take the evicted path out before swap_remove.

- Cron teardown ordering: VirtualMachine::destroy took rare_data before
  calling cron_clear_all_teardown, which early-returns when rare_data is
  None - the hook was a no-op, leaking still-registered CronJobs and
  tripping the cron_jobs.is_empty() debug assert when a job survived
  finalization (process.exit from inside a cron callback under --hot).
  Call the hook before taking rare_data.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/build/deps/webkit.ts`:
- Line 10: Update the WEBKIT_VERSION bump verification by confirming the
prebuilt artifacts exist for the new tag referenced by WEBKIT_VERSION
("f18cf9c267c72ff3d1ca31eec864ebcbeefd29b5"): check the GitHub release URL for
the tag (autobuild-<hash>) and verify presence of linux (amd64/arm64) with
default/lto/asan, macos (amd64/arm64) with default/lto, and windows (amd64) with
default/lto; if any artifacts are missing either revert or pick a tag that has
full coverage or add a short inline comment next to WEBKIT_VERSION noting which
platforms/variants were manually verified and any remaining gaps (e.g.,
baseline/debug/musl/android) so reviewers know what was checked.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0bbce492-d645-45b6-bfd9-26dacca6db2c

📥 Commits

Reviewing files that changed from the base of the PR and between f58d146 and b86e116.

📒 Files selected for processing (12)
  • .buildkite/ci.mjs
  • scripts/build/deps/webkit.ts
  • src/jsc/ResolvedSource.rs
  • src/jsc/RuntimeTranspilerStore.rs
  • src/jsc/VirtualMachine.rs
  • src/jsc/bindings/ZigSourceProvider.cpp
  • src/jsc/bindings/headers-handwritten.h
  • src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp
  • src/runtime/bake/DevServer.rs
  • src/runtime/jsc_hooks.rs
  • src/runtime/server/mod.rs
  • src/watcher/Watcher.rs

Comment thread scripts/build/deps/webkit.ts Outdated
Comment thread src/runtime/server/mod.rs Outdated
- http: send_sync returned a picohttp::Response that borrowed an
  intentionally leaked HTTPResponseMetadata (status text, header buffer,
  and the boxed headers slice leaked once per sync CLI request). Return
  the owning HTTPResponseMetadata instead; a Deref to the inner Response
  keeps all call sites unchanged and Drop reclaims the buffers. Also stop
  copying the now-droppable Response back into the caller's AsyncHTTP in
  the sync handoff so no stale alias survives the metadata's drop.
- server: Route::init takes a +1 ref on its HTMLBundle, but Route's Drop
  never released it (RefPtr has no Drop glue), stranding every bundle
  attached to a route past VM teardown. Release it explicitly, matching
  the original deinit order.
- test: html-rewriter-leak's RSS workload exceeds its 15s timeout under
  ASAN instrumentation; raise the timeout to 90s on ASAN builds only,
  keeping the workload and threshold unchanged.
- verify-baseline: the strpbrk flag on windows x64-baseline is a
  data-in-text artifact (an in-text switch jump-table entry decoding as
  xabort after a layout shift), not a real RTM instruction; widen the
  existing ceiling to [AVX, AVX2, RTM] with a comment documenting the
  evidence.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/http/lib.rs`:
- Around line 136-151: The public Deref impl and pub field
HTTPResponseMetadata.response currently expose a Copy Response<'static> that can
outlive the backing owned_buf and cause UB; remove the core::ops::Deref impl,
make the response field private, and stop using a fake 'static. Add safe
accessors on HTTPResponseMetadata (e.g., methods like status(&self) ->
StatusType, headers(&self) -> &[Header], body_slice(&self) -> &[u8] or a method
that returns a bun_picohttp::Response<'_> tied to &self) that return references
with lifetimes tied to &HTTPResponseMetadata so callers cannot copy a 'static
Response or outlive owned_buf; update any call sites that relied on Deref to use
these accessors and ensure Drop still frees owned_buf safely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: cad1df10-f406-4046-8ef4-16b8e0bcf717

📥 Commits

Reviewing files that changed from the base of the PR and between b86e116 and 7f1803a.

📒 Files selected for processing (6)
  • scripts/verify-baseline-static/allowlist-x64-windows.txt
  • src/http/AsyncHTTP.rs
  • src/http/lib.rs
  • src/runtime/server/HTMLBundle.rs
  • src/runtime/server/server_body.rs
  • test/js/workerd/html-rewriter-leak.test.ts

Comment thread src/http/lib.rs
robobun added 4 commits June 2, 2026 20:37
`schedule_deinit`'s shutdown branch frees the server synchronously, which
is UB under Stacked Borrows while any `&mut self` argument up the stack is
still protected. Convert `deinit_if_we_can`, `schedule_deinit`,
`on_request_complete`, `on_static_request_complete` (and the `ServerLike`
trait method / `AnyServer` dispatch) to the `borrow = ptr` shape: raw
`*mut Self` parameters with scoped reborrows that end before the freeing
call, matching `Watcher::thread_main` and `NewServer::deinit`.
hasWebKitChanges() still looked for SetupWebKit.cmake, which no longer
exists — the WEBKIT_VERSION pin moved to scripts/build/deps/webkit.ts —
so WebKit bumps never got --jit-stress or the longer verify-baseline
timeout.
Comment thread src/runtime/server/mod.rs Outdated
`AnyServer::{on_request_complete, on_static_request_complete}` reach
`deinit_if_we_can`, which drops the server-owned `Box<DevServer>`; the
DevServer call sites passed `&mut self` pointing into that same box
(`dev.server.as_mut()`), leaving a protected reference live across the
free. `AnyServer` is `Copy`, so take `self` by value and copy the
handle out at the call sites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants