Skip to content
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

src: use v8::(Des|S)erializeInternalFieldsCallback #53217

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented May 30, 2024

Split from #50983, that one needs more work to make the entire snapshot reproducible. This at least makes the context data slots serialized as some non-gibberish (empty) values, otherwise V8 might run into issues serializing the gibberish pointer values.

Previously V8 would just try to serialize the context data fields "verbatim" by copying the pointer values. This patch makes use of the new callbacks so that at serialization, the embedder data for the context can at least be serialized in a meaningful way (which are all reset to empty for now). Otherwise the upstream may have difficulties serializing these pointer values "verbatim" especially with the introduction of external pointer tables, even though the verbatim pointer values from a previous process is meaningless to Node.js.

For Node.js the callback currently just checks that the slots are known. We will reassign the pointers with newly created native structures during deserialization and there isn't much we can reuse for now.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments

Previously V8 would just try to serialize the context data fields
"verbatim" by copying the pointer values. This patch makes
use of the new callbacks so that at serialization, the embedder
data for the context can at least be serialized in a meaningful
way (which are all reset to empty for now). Otherwise the
upstream may have difficulties serializing these pointer values
"verbatim" especially with the introduction of external pointer
tables, even though the verbatim pointer values from a previous
process is meaningless to Node.js.

For Node.js the callback currently just checks that the slots are
know. We will reassign the pointers with newly created native
structures during deserialization and there isn't much we can
reuse for now.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 30, 2024
@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. snapshot Issues and PRs related to the startup snapshot labels May 31, 2024
@joyeecheung joyeecheung added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 6, 2024
@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 Jun 6, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/53217
✔  Done loading data for nodejs/node/pull/53217
----------------------------------- PR info ------------------------------------
Title      src: use v8::(Des|S)erializeInternalFieldsCallback (#53217)
Author     Joyee Cheung  (@joyeecheung)
Branch     joyeecheung:context-data -> nodejs:main
Labels     c++, author ready, needs-ci, snapshot
Commits    1
 - src: use v8::(Des|S)erializeInternalFieldsCallback
Committers 1
 - Joyee Cheung 
PR-URL: https://github.com/nodejs/node/pull/53217
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments
Reviewed-By: Chengzhong Wu 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/53217
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments
Reviewed-By: Chengzhong Wu 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Thu, 30 May 2024 13:11:13 GMT
   ✔  Approvals: 1
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/53217#pullrequestreview-2090507412
   ✘  This PR needs to wait 2 more hours to land (or 0 hours if there is one more approval)
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-05-30T16:38:45Z: https://ci.nodejs.org/job/node-test-pull-request/59545/
- Querying data for job/node-test-pull-request/59545/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/9399477851

@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jun 7, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 7, 2024
@nodejs-github-bot nodejs-github-bot merged commit a2233c3 into nodejs:main Jun 7, 2024
72 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in a2233c3

RafaelGSS pushed a commit that referenced this pull request Jun 7, 2024
Previously V8 would just try to serialize the context data fields
"verbatim" by copying the pointer values. This patch makes
use of the new callbacks so that at serialization, the embedder
data for the context can at least be serialized in a meaningful
way (which are all reset to empty for now). Otherwise the
upstream may have difficulties serializing these pointer values
"verbatim" especially with the introduction of external pointer
tables, even though the verbatim pointer values from a previous
process is meaningless to Node.js.

For Node.js the callback currently just checks that the slots are
know. We will reassign the pointers with newly created native
structures during deserialization and there isn't much we can
reuse for now.

PR-URL: #53217
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments
Reviewed-By: Chengzhong Wu <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Jun 7, 2024
sophonieb pushed a commit to sophonieb/node that referenced this pull request Jun 20, 2024
Previously V8 would just try to serialize the context data fields
"verbatim" by copying the pointer values. This patch makes
use of the new callbacks so that at serialization, the embedder
data for the context can at least be serialized in a meaningful
way (which are all reset to empty for now). Otherwise the
upstream may have difficulties serializing these pointer values
"verbatim" especially with the introduction of external pointer
tables, even though the verbatim pointer values from a previous
process is meaningless to Node.js.

For Node.js the callback currently just checks that the slots are
know. We will reassign the pointers with newly created native
structures during deserialization and there isn't much we can
reuse for now.

PR-URL: nodejs#53217
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments
Reviewed-By: Chengzhong Wu <[email protected]>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
Previously V8 would just try to serialize the context data fields
"verbatim" by copying the pointer values. This patch makes
use of the new callbacks so that at serialization, the embedder
data for the context can at least be serialized in a meaningful
way (which are all reset to empty for now). Otherwise the
upstream may have difficulties serializing these pointer values
"verbatim" especially with the introduction of external pointer
tables, even though the verbatim pointer values from a previous
process is meaningless to Node.js.

For Node.js the callback currently just checks that the slots are
know. We will reassign the pointers with newly created native
structures during deserialization and there isn't much we can
reuse for now.

PR-URL: nodejs#53217
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5512712/comments/cfc2b28d_c921ac80?tab=comments
Reviewed-By: Chengzhong Wu <[email protected]>
@marco-ippolito marco-ippolito added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Jul 19, 2024
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. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. needs-ci PRs that need a full CI run. snapshot Issues and PRs related to the startup snapshot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants