Repository navigation
fix(binding): avoid shared property leak warnings on process exit - #16117
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Rsdoctor Bundle Diff Analysis
Found 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 67.60MB |
Merging this PR will not alter performance
Comparing Footnotes
|
Rspack 2.2.9 prints "ObjectRef is not unref, it considered as a memory leak" on stderr when the CLI exits after a frontend build or dev server run. This is fixed in 2.3.0 (web-infra-dev/rspack#16117), so require it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25 Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Rspack 2.2.9 prints "ObjectRef is not unref, it considered as a memory leak" on stderr when the CLI exits after a frontend build or dev server run. This is fixed in 2.3.0 (web-infra-dev/rspack#16117), so require it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25 Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Rspack 2.2.9 prints "ObjectRef is not unref, it considered as a memory leak" on stderr when the CLI exits after a frontend build or dev server run. This is fixed in 2.3.0 (web-infra-dev/rspack#16117), so require it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25 Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Rspack 2.2.9 prints "ObjectRef is not unref, it considered as a memory leak" on stderr when the CLI exits after a frontend build or dev server run. This is fixed in 2.3.0 (web-infra-dev/rspack#16117), so require it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25 Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Rspack 2.2.9 prints "ObjectRef is not unref, it considered as a memory leak" on stderr when the CLI exits after a frontend build or dev server run. This is fixed in 2.3.0 (web-infra-dev/rspack#16117), so require it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25 Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Require Rspack 2.3.2. Production builds with 2.0 to 2.3.1 turn JSON that
is re-exported through CommonJS, as in `module.exports =
require('./list.json')`, into `[0]` when app code calls array methods on
it (web-infra-dev/rspack#16398, fixed by
web-infra-dev/rspack#16418). Rspack 2.3.0 also stopped printing
"ObjectRef is not unref, it considered as a memory leak" on stderr when
the CLI exits (web-infra-dev/rspack#16117).
- Insert the lazy compilation middleware before the dev middleware instead
of last, so that a proxy entry like `context: "/"` can't forward its
trigger requests to the backend.
- Throw a clear error when the `proxy` configuration isn't an array. The
new dev server no longer validates its options, and failed with
"this.options.proxy is not iterable" for an object, or proxied nothing
for a string.
- Turn off colors in the build's error and warning messages and in the
`--stats` report, which Rspack 2 colors when it detects CI or a
terminal.
- Look for the dev server overlay by its new id,
`rspack-dev-server-client-overlay`, in the e2e test. With the old id its
check for the ResizeObserver error could never fail.
- Remove the bundler stubs from the two `start` command tests. The repo
test already mocks the package start command, and the package test
loads Rspack's ESM: natively with `--experimental-vm-modules`, which
`yarn test` sets, and transformed to CommonJS without it.
- Changeset: drop the Node.js 22.12 note, as Node.js 24.15.0 is the new
minimum. Mention that `EXPERIMENTAL_LAZY_COMPILATION` now takes effect,
that the new dev server, not Rspack itself, dropped the proxy options,
and the new overlay ID.
Corrections to the upgrade commit: `@swc/helpers` was only an optional
peer of Rspack 1 too, and was installed through other packages. It is
still needed as a direct dependency, for the SWC loader's
`externalHelpers`. The proxy translation's comment now ties the match
with the legacy WebPack dev server to `context` only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25
Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Require Rspack 2.3.2. Production builds with 2.0 to 2.3.1 turn JSON that
is re-exported through CommonJS, as in `module.exports =
require('./list.json')`, into `[0]` when app code calls array methods on
it (web-infra-dev/rspack#16398, fixed by
web-infra-dev/rspack#16418). Rspack 2.3.0 also stopped printing
"ObjectRef is not unref, it considered as a memory leak" on stderr when
the CLI exits (web-infra-dev/rspack#16117).
- Insert the lazy compilation middleware before the dev middleware instead
of last, so that a proxy entry like `context: "/"` can't forward its
trigger requests to the backend.
- Throw a clear error when the `proxy` configuration isn't an array. The
new dev server no longer validates its options, and failed with
"this.options.proxy is not iterable" for an object, or proxied nothing
for a string.
- Turn off colors in the build's error and warning messages and in the
`--stats` report, which Rspack 2 colors when it detects CI or a
terminal.
- Restore `NODE_ENV` after package builds. postcss-load-config, which
loads their PostCSS configs, sets it to `development` when it isn't
set. Rspack 2's CSS minifier now targets the app's browserslist
config, whose environment follows `NODE_ENV`, so `repo build --all`
minified app CSS for the `development` browsers after it had built a
package with CSS.
- Look for the dev server overlay by its new id,
`rspack-dev-server-client-overlay`, in the e2e test. With the old id its
check for the ResizeObserver error could never fail.
- Remove the bundler stubs from the two `start` command tests. The repo
test already mocks the package start command, and the package test
loads Rspack's ESM: natively with `--experimental-vm-modules`, which
`yarn test` sets, and transformed to CommonJS without it.
- Changeset: drop the Node.js 22.12 note, as Node.js 24.15.0 is the new
minimum. Mention that `EXPERIMENTAL_LAZY_COMPILATION` now takes effect,
that the new dev server, not Rspack itself, dropped the proxy options,
the new overlay ID, and that production CSS now targets the app's
browserslist configuration.
Corrections to the upgrade commit: `@swc/helpers` was only an optional
peer of Rspack 1 too, and was installed through other packages. It is
still needed as a direct dependency, for the SWC loader's
`externalHelpers`. The proxy translation's comment now ties the match
with the legacy WebPack dev server to `context` only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25
Claude-Session: https://claude.ai/code/session_01NqdyP2EWYueT54rNhZ6PDK
Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Require Rspack 2.3.2. Production builds with 2.0 to 2.3.1 turn JSON that
is re-exported through CommonJS, as in `module.exports =
require('./list.json')`, into `[0]` when app code calls array methods on
it (web-infra-dev/rspack#16398, fixed by
web-infra-dev/rspack#16418). Rspack 2.3.0 also stopped printing
"ObjectRef is not unref, it considered as a memory leak" on stderr when
the CLI exits (web-infra-dev/rspack#16117).
- Insert the lazy compilation middleware before the dev middleware instead
of last, so that a proxy entry like `context: "/"` can't forward its
trigger requests to the backend.
- Throw a clear error when the `proxy` configuration isn't an array. The
new dev server no longer validates its options, and failed with
"this.options.proxy is not iterable" for an object, or proxied nothing
for a string.
- Turn off colors in the build's error and warning messages and in the
`--stats` report, which Rspack 2 colors when it detects CI or a
terminal.
- Restore `NODE_ENV` after package builds. postcss-load-config, which
loads their PostCSS configs, sets it to `development` when it isn't
set. Rspack 2's CSS minifier now targets the app's browserslist
config, whose environment follows `NODE_ENV`, so `repo build --all`
minified app CSS for the `development` browsers after it had built a
package with CSS.
- Look for the dev server overlay by its new id,
`rspack-dev-server-client-overlay`, in the e2e test. With the old id its
check for the ResizeObserver error could never fail.
- Remove the bundler stubs from the two `start` command tests. The repo
test already mocks the package start command, and the package test
loads Rspack's ESM: natively with `--experimental-vm-modules`, which
`yarn test` sets, and transformed to CommonJS without it.
- Changeset: drop the Node.js 22.12 note, as Node.js 24.15.0 is the new
minimum. Mention that `EXPERIMENTAL_LAZY_COMPILATION` now takes effect,
that the new dev server, not Rspack itself, dropped the proxy options,
the new overlay ID, and that production CSS now targets the app's
browserslist configuration.
Corrections to the upgrade commit: `@swc/helpers` was only an optional
peer of Rspack 1 too, and was installed through other packages. It is
still needed as a direct dependency, for the SWC loader's
`externalHelpers`. The proxy translation's comment now ties the match
with the legacy WebPack dev server to `context` only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZ521AnrvsZ2yy1AHJJK25
Claude-Session: https://claude.ai/code/session_01NqdyP2EWYueT54rNhZ6PDK
Signed-off-by: Sebastian Danielsson <sebastian.danielsson@trafikverket.se>
Motivation
Fixes #16115. Since #15883, a main-thread
process.exit()can print three NAPI-RSObjectRefwarnings after a successfulcompiler.close(). The shared accessor references intentionally live for the N-API environment lifetime, but forced process exit skips environment cleanup hooks before thread-local destruction.Changes
Use
ObjectRef<false>only for the environment-owned shared-property cache, avoiding misleading drop-time leak diagnostics during forced shutdown. Keep the existing cleanup hooks and registration-failureunref()path intact; normal environment and worker teardown still release the references.Add subprocess regression coverage for natural exit, main-thread
process.exit(), and workerprocess.exit(), each with exit codes 0 and 1. Each case populates all three caches, closes the compiler, and checks stderr and the exit status.Validation on macOS arm64 / Node.js 24.20.0: the two forced main-thread exit cases fail against the published 2.2.9 binding with three warnings each; all six shutdown cases pass with the rebuilt binding. The existing shared-accessor lifecycle and worker tests also pass. Ran
pnpm run build:binding:dev,pnpm run build:js,pnpm --dir tests/rspack-test run test -t shared-accessors(11 passed), andcargo fmt --all --check.The original Rspress dead-anchor reproduction, with a fresh persistent cache and the rebuilt binding, still exits with code 1 and reports the anchor error, with zero
ObjectRefwarnings. The binding build used a temporary path wrapper for the existing build script's handling of spaces in the checkout path; no build-script changes are included.