From 4c24e935281c586b133c8608817dfc34d984de7f Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 22 Oct 2025 00:07:31 +0200 Subject: [PATCH] test: `spawnSync` blocked thread --- .../test-apps/anr/anr-main-native/src/main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/e2e/test-apps/anr/anr-main-native/src/main.js b/test/e2e/test-apps/anr/anr-main-native/src/main.js index 959e3695..01be62d1 100644 --- a/test/e2e/test-apps/anr/anr-main-native/src/main.js +++ b/test/e2e/test-apps/anr/anr-main-native/src/main.js @@ -1,8 +1,9 @@ -const crypto = require('crypto'); +// const crypto = require('crypto'); const { app } = require('electron'); const { init } = require('@sentry/electron/main'); const { eventLoopBlockIntegration } = require('@sentry/electron/native'); +const { spawnSync } = require('child_process'); global._sentryDebugIds = { [new Error().stack]: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa' }; @@ -14,11 +15,14 @@ init({ }); function longWork() { - for (let i = 0; i < 100; i++) { - const salt = crypto.randomBytes(128).toString('base64'); - // eslint-disable-next-line no-unused-vars - const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); - } + // for (let i = 0; i < 100; i++) { + // const salt = crypto.randomBytes(128).toString('base64'); + // // eslint-disable-next-line no-unused-vars + // const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); + // } + console.time('ping localhost'); + spawnSync('ping localhost', { shell: true, timeout: 10000 }); + console.timeEnd('ping localhost'); } app.on('ready', () => {