Skip to content

deps: update lolhtml to v2.7.1 - #26

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
deps/update-lolhtml-10
Open

github-actions[bot] wants to merge 1 commit into
mainfrom
deps/update-lolhtml-10

Conversation

@github-actions

Copy link
Copy Markdown

What does this PR do?

Updates lolhtml to version v2.7.1

Compare: cloudflare/lol-html@d64457d...e9e16dc

Auto-updated by this workflow

@github-actions
github-actions Bot force-pushed the deps/update-lolhtml-10 branch from 082fd8d to c16c257 Compare February 15, 2026 01:32
crishoj pushed a commit that referenced this pull request Jul 29, 2026
…aking it (oven-sh#36335)

## Problem

`test/cli/install/bun-info.test.ts` (and its sibling
`bun-audit.test.ts`) started aborting on the `:debian: 13 x64-asan` PR
lane with a LeakSanitizer report after oven-sh#36175 landed (observed on builds
84674 / 84751 / 84815 / 84881):

```
==19020==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 512 byte(s) in 1 object(s) allocated from:
    ...
    #16 in <bun_http::HTTPClient>::clone_metadata src/http/lib.rs:3977:13
    #17 in handle_on_data_headers<true> src/http/lib.rs:3761:14
    ...
    #26 in <bun_http::http_thread::HttpThread>::process_events
```

## Cause

`AsyncHTTP::send_sync` wrapped the terminal `HTTPResponseMetadata` in
`ManuallyDrop` and returned the inner `picohttp::Response<'static>`:

```rust
let metadata = core::mem::ManuallyDrop::new(metadata);
Ok(metadata.response)
```

This was carried over from the Zig port (the original `sendSync`
returned the bare `Response` and never `deinit`'d the metadata). It
leaks two heap allocations per call: the `Box<[Header]>` leaked via
`heap::release` in `clone_metadata`, and the `StringBuilder`-owned
`owned_buf` that holds status text / header names / header values. Every
sync CLI request goes through this path: `bun info` / `bun pm view`,
`bun audit`, `bun publish` (up to four times with the OTP retry), `bun
upgrade`, `bun create`, and `build --compile`'s target download.

LSan's default scan is conservative, treating stacks and registers of
every thread as roots. The only live reference to the leaked header
slice after the command returns is the `Response` alias stored in
`real.response` by `send_sync_callback`, and that lives on a frame
already below the main thread's SP when `Global::exit` runs the leak
check. Whether LSan still sees it depends on whether a thread happened
to park in epoll / a futex with a stale pointer to the slice in a
callee-saved register. On the x64-asan PR lane it stopped being hidden
after oven-sh#36175; locally it stays hidden unless registers are excluded as
roots. A fix for this leak already exists on the
`farm/3977ed4f/linux-arm64-asan-ci` branch (7f1803a) and in oven-sh#36173;
this PR extracts just the leak fix to unblock the x64-asan lane.

## Fix

Return the owning `HTTPResponseMetadata` from `send_sync`. Accessor
methods (`status_code()`, `status_text()`, `header()`,
`header_if_other_is_absent()`) hand out reborrows tied to `&self` so
borrowck enforces that no slice escapes the metadata's scope; the inner
`Response` is typed `'static` but its slices borrow the sibling
`owned_buf` / header slice that `Drop` frees. Callers switch from
`res.status_code` / `res.headers.get(..)` to the accessor form.
`npm::response_error` now takes `&HTTPResponseMetadata` directly.
`send_sync_callback` writes `real.response = None` instead of copying
the alias back into the caller's `AsyncHTTP`, since that stored copy
would dangle once the returned metadata is dropped and no sync caller
reads `self.response`.

## Test

Added an ASAN-gated case to `bun-info.test.ts` that runs `bun info`
against a local `Bun.serve` registry with `LSAN_OPTIONS=use_registers=0`
so the leak is observed deterministically, and asserts a combined `{
stdout, stderr, exitCode }` result with LSan's default non-zero exit
left intact.

```
# fail-before (src/ reverted to main, debug build)
(fail) bun info does not leak the sync response metadata [5307ms]
  SUMMARY: AddressSanitizer: 206 byte(s) leaked in 2 allocation(s).

# pass-after
bun bd test test/cli/install/bun-info.test.ts
 20 pass  0 fail  (new leak test: 223ms)

bun bd test test/cli/install/bun-audit.test.ts     # 16 pass
bun bd test test/cli/install/bun-create.test.ts    # 19 pass
bun bd test test/cli/install/bun-upgrade.test.ts   #  8 pass
```

<!-- robobun:evidence:begin -->

---

**[review]** gate passed · iteration 1 · 10 files touched

<details><summary>fails on main (without fix)</summary>

```console
ASAN without fix: 1 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/cli/install/bun-info.test.ts
bun test v1.4.0 (8f0ef47)

test/cli/install/bun-info.test.ts:
(pass) bun info > bun info (main command) > should display package info for latest version [359.12ms]
(pass) bun info > bun info (main command) > should handle missing arguments [346.80ms]
(pass) bun info > bun info (main command) > should display package info for specific version [402.47ms]
(pass) bun info > bun pm view (alias) > should display package info for latest version [380.58ms]
(pass) bun info > bun info (main command) > should display specific property [484.38ms]
(pass) bun info > bun pm view (alias) > should display package info for specific version [380.99ms]
(pass) bun info > bun pm view (alias) > should display nested property [324.88ms]
(pass) bun info > bun pm view (alias) > should handle non-existent package [297.70ms]
(pass) bun info > bun pm view (alias) > should display specific property [1379.12ms]
(pass) bun info > bun pm view (alias) > should output JSON format with --json flag [1356.80ms]
(pass) bun info > bun pm v
... (truncated)

release without fix: 1 skipped
bun test v1.4.0-canary.1 (b4544d0)

test/cli/install/bun-info.test.ts:
(pass) bun info > bun info (main command) > should display package info for latest version [69.02ms]
(pass) bun info > bun info (main command) > should handle missing arguments [68.71ms]
(pass) bun info > bun pm view (alias) > should handle non-existent package [62.61ms]
(pass) bun info > bun pm view (alias) > should display package info for latest version [71.24ms]
(pass) bun info > bun pm view (alias) > should display nested property [69.87ms]
(pass) bun info > bun pm view (alias) > should handle . [61.86ms]
(pass) bun info > bun info (main command) > should display package info for specific version [75.65ms]
(pass) bun info > bun info (main command) > should display specific property [77.38ms]
(pass) bun info > bun pm view (alias) > should output JSON format with --json flag [78.60ms]
(pass) bun info > bun pm view (alias) > versions[0] should work [71.64ms]
(pass) bun info > bun pm view (alias) > versions should work [75.43ms]
(pass) bun info > bun pm view (alias) > should handle dist-tags like latest [74.19ms]
(pass) bun info > bun pm view (alias) > should handle version ranges [78.07ms]
(p
... (truncated)
```

</details>

<details><summary>passes on PR (with fix)</summary>

```console
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/cli/install/bun-info.test.ts
bun test v1.4.0 (8f0ef47)

test/cli/install/bun-info.test.ts:
(pass) bun info > bun info (main command) > should display package info for latest version [349.74ms]
(pass) bun info > bun info (main command) > should display package info for specific version [468.60ms]
(pass) bun info > bun info (main command) > should display specific property [469.69ms]
(pass) bun info > bun info (main command) > should handle missing arguments [475.25ms]
(pass) bun info > bun pm view (alias) > should display package info for latest version [506.84ms]
(pass) bun info > bun pm view (alias) > should display package info for specific version [460.48ms]
(pass) bun info > bun pm view (alias) > should display nested property [392.82ms]
(pass) bun info > bun pm view (alias) > should display specific property [507.04ms]
(pass) bun info > bun pm view (alias) > should handle non-existent package [458.13ms]
(pass) bun info > bun pm view (alias) > should output JSON format with --json flag [575.15ms]
(pass) bun info > bun pm vie
... (truncated)

release with fix: 1 skipped
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 1113ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/6] gen generated_host_exports.rs
generated_host_exports.rs: 94 exports (host=3, lazy=10, generic=81, rust=0); 240 extern-C blocks audited
[1/6] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m   Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
�[1m�[92m   Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
�[1m�[92m   Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
�[1m�[92m   Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1m�[92m   Compiling�[0m bun_zlib_sys v0.0.0 (/workspace/bun/src/zlib_sys)
�[1m�[92m   Compiling�[0m bun_cares_sys v0.0.0 (/workspace/bun/src/cares_sys)
�[1m�[92m   Compiling�[0m bun_zstd v0.0.0 (/workspace/bun/src/zstd)
�[1m�[92m   Compiling�[0m bun_collections v0.0.0 (/workspace/bun/src/collections)
�[1m�[92m   Compiling�[0m bun_p
... (truncated)
```

</details>

<details><summary>diff hotspot</summary>

```
src/http/AsyncHTTP.rs                         | 12 +++--
 src/http/lib.rs                               | 22 +++++++++
 src/install/npm.rs                            | 23 +++++-----
 src/runtime/cli/audit_command.rs              |  4 +-
 src/runtime/cli/create_command.rs             | 14 +++---
 src/runtime/cli/pm_view_command.rs            |  2 +-
 src/runtime/cli/publish_command.rs            | 28 +++++-------
 src/runtime/cli/upgrade_command.rs            |  4 +-
 src/standalone_graph/StandaloneModuleGraph.rs |  2 +-
 test/cli/install/bun-info.test.ts             | 65 +++++++++++++++++++++++++--
 10 files changed, 125 insertions(+), 51 deletions(-)
```

</details>

**gate history** · 2 passed · 1 rejected · iteration 1

<details><summary>evidence per changed file</summary>

```
file                                           reads  edits  tests
src/http/AsyncHTTP.rs                              5      6      0
src/http/lib.rs                                    5      4      0
src/install/npm.rs                                 0      0      0
src/runtime/cli/audit_command.rs                   1      0      0
src/runtime/cli/create_command.rs                  2      0      0
src/runtime/cli/pm_view_command.rs                 2      0      0
src/runtime/cli/publish_command.rs                 2      0      0
src/runtime/cli/upgrade_command.rs                 1      0      0
src/standalone_graph/StandaloneModuleGraph.rs      1      0      0
test/cli/install/bun-info.test.ts                  6     11      0
```

</details>

<!-- robobun:evidence:end -->

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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.

1 participant