Skip to content

test: account for truthy signal in flaky async_hooks tests #58478

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/async-hooks/test-emit-after-on-destroyed.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,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.on('close', common.mustCall((code) => {
assert.strictEqual(code, 1);
child.on('close', common.mustCall((code, signal) => {
if (signal) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this PR from #58567 and it seems to me this is more sweeping the issue under the rug, because the test should not really expect a signal to appear as it does not actively kill the child process. If the child process is killed by a signal, something is going wrong, and the changes here would be masking it. If it's just AIX machine weirdness the right workaround should probably be branching on AIX and ignore if the signal is from a known set (but SIGSEGV, etc. shouldn't be expected in any case, otherwise if someone breaks the path by introducing a memory corruption etc. the test would ignore it).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we revert this?

Copy link
Member Author

@RaisinTen RaisinTen Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flaky test report #58199 of another test which is very similar to this one shows that this can happen on Linux x64 too. The failure in #58122 (comment) on 6 May, according to Jenkins, is the only place where I have seen it fail on Linux x64. I checked a couple of failures before and after that one in the sequence of Jenkins CI runs on that machine and I wasn't able to find more occurrences. The only ones that happened more frequently and got recorded in the reliability repo are the AIX failures from 20 to 28 May recently and the ancient ones from 2023.

In #58463 (comment), @Flarna suggested that this might be caused by a resource limitation.

A complete revert would reintroduce the flake whereas this could still be improved. Sent a PR: #58601.

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})`);
Expand Down
8 changes: 6 additions & 2 deletions test/async-hooks/test-improper-unwind.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,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.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})`);
Expand Down
Loading