From 5aac532a37b8c0185b6199cc6083d1f9e5360514 Mon Sep 17 00:00:00 2001 From: Baki Gul Date: Tue, 3 Jun 2025 14:07:24 +0300 Subject: [PATCH 1/7] test: deflake async-hooks/test-improper-order on AIX #58562 --- test/async-hooks/test-improper-order.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index 5452e2c6e05030..db799444ea0e02 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -51,8 +51,14 @@ if (process.argv[2] === 'child') { child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); }); child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); - child.on('close', common.mustCall((code) => { - assert.strictEqual(code, 1); + + + child.on('close', common.mustCall((code, signal) => { + if (signal) { + console.log(`Child closed with signal: ${signal}`); + } else { + assert.strictEqual(code, 1); + } assert.match(outData.toString(), heartbeatMsg, 'did not crash until we reached offending line of code ' + `(found ${outData})`); From 1a80d8a5e12b8dc4a09c74511af8c9923fb3eb22 Mon Sep 17 00:00:00 2001 From: baki gul <76937950+gulbaki@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:17:40 +0300 Subject: [PATCH 2/7] Update test-improper-order.js --- test/async-hooks/test-improper-order.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index db799444ea0e02..87e9668021e665 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -51,8 +51,6 @@ if (process.argv[2] === 'child') { child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); }); child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); - - child.on('close', common.mustCall((code, signal) => { if (signal) { console.log(`Child closed with signal: ${signal}`); From 0d35e9bfe53cf2a76507e3e1f8a770d9240caa82 Mon Sep 17 00:00:00 2001 From: baki gul Date: Tue, 3 Jun 2025 14:48:40 +0300 Subject: [PATCH 3/7] update test-improper-order.js --- test/async-hooks/test-improper-order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index 87e9668021e665..fc98ef6becedcf 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -52,7 +52,7 @@ if (process.argv[2] === 'child') { child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); child.on('close', common.mustCall((code, signal) => { - if (signal) { + if (signal) { console.log(`Child closed with signal: ${signal}`); } else { assert.strictEqual(code, 1); From 0427368684e412cd9372c8bd414abbc730eef621 Mon Sep 17 00:00:00 2001 From: baki gul Date: Wed, 4 Jun 2025 21:31:40 +0300 Subject: [PATCH 4/7] test: improve exit handling in async-hooks/test-improper-order --- test/async-hooks/test-improper-order.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index fc98ef6becedcf..c4f7c4a4c0e451 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -51,12 +51,12 @@ if (process.argv[2] === 'child') { child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); }); child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); + child.once('exit', common.mustCall((code, signal) => { + assert.strictEqual(code, 1); + assert.strictEqual(signal, null); + })); + child.on('close', common.mustCall((code, signal) => { - if (signal) { - console.log(`Child closed with signal: ${signal}`); - } else { - assert.strictEqual(code, 1); - } assert.match(outData.toString(), heartbeatMsg, 'did not crash until we reached offending line of code ' + `(found ${outData})`); From 4a23c0f445e5a922c0ea3b267cc4cf03c22c2503 Mon Sep 17 00:00:00 2001 From: baki gul Date: Fri, 6 Jun 2025 18:51:12 +0300 Subject: [PATCH 5/7] test: improve flakiness detection on stack corruption tests --- test/async-hooks/test-improper-order.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index c4f7c4a4c0e451..61e405f5ff335f 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -51,12 +51,15 @@ if (process.argv[2] === 'child') { child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); }); child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); - child.once('exit', common.mustCall((code, signal) => { - assert.strictEqual(code, 1); - assert.strictEqual(signal, null); - })); - child.on('close', common.mustCall((code, signal) => { + if ((common.isAIX || + (common.isLinux && process.arch === 'x64')) && + signal === 'SIGABRT') { + // XXX: The child process could be aborted due to unknown reasons. Work around it. + } else { + assert.strictEqual(signal, null); + assert.strictEqual(code, 1); + } assert.match(outData.toString(), heartbeatMsg, 'did not crash until we reached offending line of code ' + `(found ${outData})`); From 381034ac93f297c5dc2f39f12735904b6dfaef6a Mon Sep 17 00:00:00 2001 From: baki gul <76937950+gulbaki@users.noreply.github.com> Date: Sun, 8 Jun 2025 22:52:27 +0300 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Darshan Sen --- test/async-hooks/test-improper-order.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index 61e405f5ff335f..8a9f70f1ebd506 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -53,9 +53,9 @@ if (process.argv[2] === 'child') { child.on('close', common.mustCall((code, signal) => { if ((common.isAIX || - (common.isLinux && process.arch === 'x64')) && - signal === 'SIGABRT') { - // XXX: The child process could be aborted due to unknown reasons. Work around it. + (common.isLinux && process.arch === 'x64')) && + signal === 'SIGABRT') { + // XXX: The child process could be aborted due to unknown reasons. Work around it. } else { assert.strictEqual(signal, null); assert.strictEqual(code, 1); From e9f848858950a4dc703be2df0d2cf6350ebeb4ce Mon Sep 17 00:00:00 2001 From: baki gul Date: Mon, 9 Jun 2025 16:49:38 +0300 Subject: [PATCH 7/7] fix lint --- test/async-hooks/test-improper-order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index 8a9f70f1ebd506..f39c79a72bc85c 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -55,7 +55,7 @@ if (process.argv[2] === 'child') { if ((common.isAIX || (common.isLinux && process.arch === 'x64')) && signal === 'SIGABRT') { - // XXX: The child process could be aborted due to unknown reasons. Work around it. + // XXX: The child process could be aborted due to unknown reasons. Work around it. } else { assert.strictEqual(signal, null); assert.strictEqual(code, 1);