Skip to content

build: fix pointer compression builds #58171

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
wants to merge 2 commits into from

Conversation

joyeecheung
Copy link
Member

build: fix pointer compression builds

  • Remove usage of deprecated V8::InitializeSandbox().
  • External code space and pointer compression shared cage must
    be enabled when pointer compression builds are enabled.
  • We cannot enable the sandbox because that requires allocating
    the array buffer backing stores in the sandbox - we currently
    have many backing stores tied to pointers from C++ land that
    are not even necessarily dynamic (e.g. in static storage).
    Until we manage to get rid of all those, sandbox cannot be
    enabled. Note that enabling pointer compression without
    enabling sandbox is unsupported by V8, and can be broken
    at any time.

test: skip wasm-allocation tests for pointer compression builds

V8 isolate group initialization forces allocation of the virtual
memory cage with pointer compression builds and simply would not
work when there is a smaller hard limit on the virtual memory.

- Remove usage of deprecated V8::InitializeSandbox().
- External code space and pointer compression shared cage must
  be enabled when pointer compression builds are enabled.
- We cannot enable the sandbox because that requires allocating
  the array buffer backing stores in the sandbox - we currently
  have many backing stores tied to pointers from C++ land that
  are not even necessarily dynamic (e.g. in static storage).
  Until we manage to get rid of all those, sandbox cannot be
  enabled. Note that enabling pointer compression without
  enabling sandbox is unsupported by V8, and can be broken
  at any time.
V8 isolate group initialization forces allocation of the virtual
memory cage with pointer compression builds and simply would not
work when there is a smaller hard limit on the virtual memory.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels May 4, 2025
@joyeecheung
Copy link
Member Author

Trying to start a pointer compression build: https://ci.nodejs.org/job/node-test-commit-linux-pointer-compression/784/

@nodejs-github-bot
Copy link
Collaborator

Copy link

codecov bot commented May 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.14%. Comparing base (5fb879c) to head (a3fab01).
Report is 134 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #58171    +/-   ##
========================================
  Coverage   90.13%   90.14%            
========================================
  Files         630      630            
  Lines      186611   186754   +143     
  Branches    36631    36652    +21     
========================================
+ Hits       168204   168351   +147     
- Misses      11192    11193     +1     
+ Partials     7215     7210     -5     

see 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@joyeecheung
Copy link
Member Author

CI is happy. Can I get some reviews please? @nodejs/build @nodejs/v8-update

@juanarbol
Copy link
Member

This is so good!

@avcribl
Copy link

avcribl commented May 13, 2025

@joyeecheung Have you checked if there is any memory leak with this approach? We have tried a similar approach to this PR, and it caused a memory leak. Enabling pointer compression without enabling sandbox, as the V8 does not support it, would cause this leak.

@joyeecheung
Copy link
Member Author

joyeecheung commented May 13, 2025

I didn't check anything other than whether the tests pass, since my goal is just to make the CI green again, even if there is a leak it's better than being broken completely and make the daily master CI red every day, and if there's a bug the fix likely needs to be in the upstream anyway, and isn't caught by our tests so it would just be like many other known issues we have even with the regular build, waiting for other volunteers to fix.

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label May 13, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 15, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 18, 2025

@jasnell
Copy link
Member

jasnell commented May 18, 2025

...Enabling pointer compression without enabling sandbox, as the V8 does not support it, would cause this leak.

In workerd we run with a configuration that enables pointer compression without the sandbox and have for some time. Yes, there are times when we see issues with v8 updates but they are rare but I don't believe we've seen leaks. I think ideally we want to work towards enabling the sandbox but there are lots of fixups we need to do first, so I think starting here and working towards that goal incrementally is best.

@jasnell jasnell added commit-queue Add this label to land a pull request using GitHub Actions. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 18, 2025
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels May 18, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/58171
✔  Done loading data for nodejs/node/pull/58171
----------------------------------- PR info ------------------------------------
Title      build: fix pointer compression builds (#58171)
Author     Joyee Cheung <[email protected]> (@joyeecheung)
Branch     joyeecheung:fix-pointer-compression -> nodejs:main
Labels     build, v8 engine, test, tools, author ready, needs-ci
Commits    2
 - build: fix pointer compression builds
 - test: skip wasm-allocation tests for pointer compression builds
Committers 1
 - Joyee Cheung <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sun, 04 May 2025 19:47:28 GMT
   ✔  Approvals: 3
   ✔  - Michaël Zasso (@targos) (TSC): https://github.com/nodejs/node/pull/58171#pullrequestreview-2817969673
   ✔  - Juan José Arboleda (@juanarbol): https://github.com/nodejs/node/pull/58171#pullrequestreview-2827093221
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/58171#pullrequestreview-2831915105
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2025-05-18T07:41:05Z: https://ci.nodejs.org/job/node-test-pull-request/66878/
- Querying data for job/node-test-pull-request/66878/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 58171
From https://github.com/nodejs/node
 * branch                  refs/pull/58171/merge -> FETCH_HEAD
✔  Fetched commits as 9eb9c26b261e..a3fab01641b8
--------------------------------------------------------------------------------
Auto-merging common.gypi
Auto-merging configure.py
Auto-merging tools/v8_gypfiles/features.gypi
[main 46f4cc58f9] build: fix pointer compression builds
 Author: Joyee Cheung <[email protected]>
 Date: Sun May 4 20:58:06 2025 +0200
 4 files changed, 22 insertions(+), 4 deletions(-)
Auto-merging tools/test.py
[main 78e79d96e7] test: skip wasm-allocation tests for pointer compression builds
 Author: Joyee Cheung <[email protected]>
 Date: Sun May 4 21:38:34 2025 +0200
 2 files changed, 5 insertions(+), 1 deletion(-)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
build: fix pointer compression builds
  • Remove usage of deprecated V8::InitializeSandbox().
  • External code space and pointer compression shared cage must
    be enabled when pointer compression builds are enabled.
  • We cannot enable the sandbox because that requires allocating
    the array buffer backing stores in the sandbox - we currently
    have many backing stores tied to pointers from C++ land that
    are not even necessarily dynamic (e.g. in static storage).
    Until we manage to get rid of all those, sandbox cannot be
    enabled. Note that enabling pointer compression without
    enabling sandbox is unsupported by V8, and can be broken
    at any time.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>

[detached HEAD 44a98bc64d] build: fix pointer compression builds
Author: Joyee Cheung <[email protected]>
Date: Sun May 4 20:58:06 2025 +0200
4 files changed, 22 insertions(+), 4 deletions(-)
Rebasing (3/4)
Rebasing (4/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: skip wasm-allocation tests for pointer compression builds

V8 isolate group initialization forces allocation of the virtual
memory cage with pointer compression builds and simply would not
work when there is a smaller hard limit on the virtual memory.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>

[detached HEAD ef93c6f910] test: skip wasm-allocation tests for pointer compression builds
Author: Joyee Cheung <[email protected]>
Date: Sun May 4 21:38:34 2025 +0200
2 files changed, 5 insertions(+), 1 deletion(-)
Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/15097514259

@jasnell jasnell removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label May 18, 2025
@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels May 18, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 18, 2025
@nodejs-github-bot
Copy link
Collaborator

Landed in db2aae8...20c4b80

nodejs-github-bot pushed a commit that referenced this pull request May 18, 2025
- Remove usage of deprecated V8::InitializeSandbox().
- External code space and pointer compression shared cage must
  be enabled when pointer compression builds are enabled.
- We cannot enable the sandbox because that requires allocating
  the array buffer backing stores in the sandbox - we currently
  have many backing stores tied to pointers from C++ land that
  are not even necessarily dynamic (e.g. in static storage).
  Until we manage to get rid of all those, sandbox cannot be
  enabled. Note that enabling pointer compression without
  enabling sandbox is unsupported by V8, and can be broken
  at any time.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
nodejs-github-bot pushed a commit that referenced this pull request May 18, 2025
V8 isolate group initialization forces allocation of the virtual
memory cage with pointer compression builds and simply would not
work when there is a smaller hard limit on the virtual memory.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@qidirbaev

This comment was marked as off-topic.

targos pushed a commit that referenced this pull request May 31, 2025
- Remove usage of deprecated V8::InitializeSandbox().
- External code space and pointer compression shared cage must
  be enabled when pointer compression builds are enabled.
- We cannot enable the sandbox because that requires allocating
  the array buffer backing stores in the sandbox - we currently
  have many backing stores tied to pointers from C++ land that
  are not even necessarily dynamic (e.g. in static storage).
  Until we manage to get rid of all those, sandbox cannot be
  enabled. Note that enabling pointer compression without
  enabling sandbox is unsupported by V8, and can be broken
  at any time.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this pull request May 31, 2025
V8 isolate group initialization forces allocation of the virtual
memory cage with pointer compression builds and simply would not
work when there is a smaller hard limit on the virtual memory.

PR-URL: #58171
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants