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

Snapshot test failures #237

Closed
targos opened this issue Aug 10, 2022 · 6 comments · Fixed by nodejs/node#44279
Closed

Snapshot test failures #237

targos opened this issue Aug 10, 2022 · 6 comments · Fixed by nodejs/node#44279

Comments

@targos
Copy link
Member

targos commented Aug 10, 2022

https://github.com/nodejs/node-v8/runs/7761703491?check_suite_focus=true

/cc @joyeecheung

@targos
Copy link
Member Author

targos commented Aug 10, 2022

For example, one of the errors:

node:assert:124
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

null !== 0

    at Object.<anonymous> (/home/runner/work/node-v8/node-v8/test/parallel/test-snapshot-warning.js:40:12)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: null,
  expected: 0,
  operator: 'strictEqual'
}

Node.js v19.0.0-pre
--- stdout ---
# Check snapshot scripts that do not emit warnings.
[stderr]: Unknown external reference 0x55c318be73b0.
<unresolved>

[stdout]: 
SIGTRAP
Command: out/Release/node /home/runner/work/node-v8/node-v8/test/parallel/test-snapshot-warning.js

@joyeecheung
Copy link
Member

Looks like it's caused by an unknown external reference somewhere. I'll try to build it locally to see what the reference is. Do I simply need to build the canary branch from this repo?

@targos
Copy link
Member Author

targos commented Aug 10, 2022

Do I simply need to build the canary branch from this repo?

Yes

@joyeecheung
Copy link
Member

Traced this back to https://chromium-review.googlesource.com/c/v8/v8/+/3776678, which added a v8::External to the V8Console, and this band-aid makes the crash go away

diff --git a/lib/internal/main/mksnapshot.js b/lib/internal/main/mksnapshot.js
index c4ea3a06cf..47e0e09495 100644
--- a/lib/internal/main/mksnapshot.js
+++ b/lib/internal/main/mksnapshot.js
@@ -127,6 +127,7 @@ function main() {

   require('internal/v8/startup_snapshot').initializeCallbacks();

+  delete console.createTask;
   if (getOptionValue('--inspect-brk')) {
     internalBinding('inspector').callAndPauseOnStart(
       serializeMainFunction, undefined,

I'll see if we can do something like what's been done for v8::Isolate::async_event_delegate and resolve this within v8

@joyeecheung
Copy link
Member

After looking into it a bit I think we should simply remove the inspector console methods during serialization because V8 is always going to re-install them when another inspector client is created during deserialization - with a new reference to the new inspector console. I created a commit that works on both the canary branch here and the main branch in the main repo (these methods are renamed in the new version of V8 so we can't hard-code the methods to remove) at https://github.com/joyeecheung/node/tree/fix-createtask, which depends on nodejs/node#44203 (which is also necessary to fix the two additional failures in snapshot-warning and snapshot-typescript tests in the canary, as the newer version of V8 is also less permissive with re-installing Error.stackTraceLimit in the release builds). I'll open a PR to the upstream after nodejs/node#44203 lands.

@joyeecheung
Copy link
Member

Opened nodejs/node#44279

nodejs-github-bot pushed a commit to nodejs/node that referenced this issue Sep 7, 2022
Some console methods are created by the V8 inspector after
an inspector client is created, reset them to undefined during
sereialization to avoid holding on to invalid references in
the snapshot. V8 will take care of the re-initialization when
another inspector client is created during deserialization.

PR-URL: #44279
Fixes: nodejs/node-v8#237
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fyko pushed a commit to Fyko/node that referenced this issue Sep 15, 2022
Some console methods are created by the V8 inspector after
an inspector client is created, reset them to undefined during
sereialization to avoid holding on to invalid references in
the snapshot. V8 will take care of the re-initialization when
another inspector client is created during deserialization.

PR-URL: nodejs#44279
Fixes: nodejs/node-v8#237
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit to nodejs/node that referenced this issue Sep 26, 2022
Some console methods are created by the V8 inspector after
an inspector client is created, reset them to undefined during
sereialization to avoid holding on to invalid references in
the snapshot. V8 will take care of the re-initialization when
another inspector client is created during deserialization.

PR-URL: #44279
Fixes: nodejs/node-v8#237
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit to nodejs/node that referenced this issue Sep 26, 2022
Some console methods are created by the V8 inspector after
an inspector client is created, reset them to undefined during
sereialization to avoid holding on to invalid references in
the snapshot. V8 will take care of the re-initialization when
another inspector client is created during deserialization.

PR-URL: #44279
Fixes: nodejs/node-v8#237
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.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 a pull request may close this issue.

2 participants