Repository navigation
Investigate persistent Windows test failure on test.wasi/test-return-on-exit #37374
Description
Activity
Refs: #36139 (comment)
@nodejs/platform-windows
- addedflaky-testIssues and PRs involving tests that fail intermittently in CI.Issues and PRs involving tests that fail intermittently in CI.wasiIssues and PRs related to the WebAssembly System Interface.Issues and PRs related to the WebAssembly System Interface.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
on Feb 15, 2021 Since this apparently started happening with the V8 update to 8.8: @nodejs/v8
- addedv8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
on Feb 15, 2021 Also @nodejs/wasi
There's probably a real bug somewhere, because this only happens on a 32 bit system.
There's probably a real bug somewhere, because this only happens on a 32 bit system.
Any thoughts on how we can make some progress on this?
Refs: #36139 (comment)
@gengjiawen Any ideas on what to do here?
@nodejs/testing Any ideas for what we might be able to do in CI or elsewhere to figure this out?
I agree that this is probably a genuine bug since it only shows up on 32-bit Windows, and coincided with the V8 8.8 update (which had wasm related changes). The
returnOnExitfeature also relies on somewhat corner case behavior - monkey patching the WASI import to throw a JavaScript exception that WebAssembly can't catch.Regarding the test - as a last resort, we could skip it on Windows. It looks like there are two test cases in
test/wasi/test-return-on-exit.js. Can we identify which of them is causing the crash, or if splitting them into separate test files somehow mitigates the problem?Reacted by Jiawen Geng- Reacted by Rich Trott
I re-ran the Windows CI a couple times as well. All failures were in
test-return-on-exit-1, which contains the following code:// Flags: --experimental-wasi-unstable-preview1 'use strict'; const common = require('../common'); const assert = require('assert'); const fs = require('fs'); const path = require('path'); const { WASI } = require('wasi'); const wasmDir = path.join(__dirname, 'wasm'); const modulePath = path.join(wasmDir, 'exitcode.wasm'); const buffer = fs.readFileSync(modulePath); (async () => { // Verify that if a WASI application throws an exception, Node rethrows it // properly. const wasi = new WASI({ returnOnExit: true }); wasi.wasiImport.proc_exit = () => { throw new Error('test error'); }; const importObject = { wasi_snapshot_preview1: wasi.wasiImport }; const { instance } = await WebAssembly.instantiate(buffer, importObject); assert.throws(() => { wasi.start(instance); }, /^Error: test error$/); })().then(common.mustCall());
The main difference here is that
wasi.wasiImport.proc_exit()is monkey-patched a second time here to throw anErrorobject, rather than throwing aSymbolasreturnOnExitwould normally.I noticed another small difference that shouldn't have any impact. In the flaky test, the
proc_exit()function is not bound to the WASI import. I ran cjihrig@32cb5b7 through the CI a few times, and haven't seen this test fail. Maybe I'm doing something wrong? If that does fix the flakiness, this seems like a probable bug in V8.- added a commit that references this issue
on Mar 5, 2021 - added a commit that references this issue
on Mar 16, 2021 - added a commit that references this issue
on May 1, 2021 - added a commit that references this issue
on May 22, 2026
https://ci.nodejs.org/job/node-test-binary-windows-js-suites/8229/RUN_SUBSET=3,nodes=win2012r2-COMPILED_BY-vs2019-x86/console and pretty much any other recent Jenkins CI run as the failure is persistent.