From 0087719aa6efc95f314a60695abf9612ebfce2e3 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Mon, 12 Aug 2024 17:27:48 +0800 Subject: [PATCH] fix: probabilistic trigger v8 crash There is a probability of triggering a v8 crash when running the `yarn list --prod --json` command. Related discussion: https://github.com/nodejs/node/issues/51555 This issue does not always occur. When we build `vscode-reh-linux-arm64` in the Dockerfile, there is more than a 50% chance of failure. If this PR is merged, the code related to DISABLE_V8_COMPILE_CACHE in vscode can also be removed (https://github.com/search?q=repo%3Amicrosoft%2Fvscode%20DISABLE_V8_COMPILE_CACHE&type=code). Globally setting `DISABLE_V8_COMPILE_CACHE=1` will increase the entire build time by 3 to 5 minutes. Signed-off-by: Kevin Cui --- src/npm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/npm.ts b/src/npm.ts index c355cbef..9ca5d84b 100644 --- a/src/npm.ts +++ b/src/npm.ts @@ -158,7 +158,7 @@ async function getYarnProductionDependencies(cwd: string, packagedDependencies?: const raw = await new Promise((c, e) => cp.exec( 'yarn list --prod --json', - { cwd, encoding: 'utf8', env: { ...process.env }, maxBuffer: 5000 * 1024 }, + { cwd, encoding: 'utf8', env: { ...process.env, DISABLE_V8_COMPILE_CACHE: 1 }, maxBuffer: 5000 * 1024 }, (err, stdout) => (err ? e(err) : c(stdout)) ) );