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

Conversation

RaisinTen
Copy link
Member

When the spawned child process gets closed with a signal, the exit code is not set and that is why the exit code assertion was failing. This change adjusts the test to check the signal and if it is truthy, it doesn't assert the exit code and instead logs the signal and continues the rest of the assertions.

Refs: #58463 (comment)
Refs: #58199
Refs: #58463

When the spawned child process gets closed with a signal, the exit code
is not set and that is why the exit code assertion was failing. This
change adjusts the test to check the signal and if it is truthy, it
doesn't assert the exit code and instead logs the signal and continues
the rest of the assertions.

Refs: nodejs#58463 (comment)
Refs: nodejs#58199
Refs: nodejs#58463
Signed-off-by: Darshan Sen <raisinten@gmail.com>
@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels May 27, 2025
@nodejs-github-bot

This comment was marked as outdated.

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 27, 2025
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.20%. Comparing base (c3b580d) to head (43ecf2f).
Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58478      +/-   ##
==========================================
+ Coverage   90.19%   90.20%   +0.01%     
==========================================
  Files         635      635              
  Lines      187255   187344      +89     
  Branches    36775    36796      +21     
==========================================
+ Hits       168896   169003     +107     
+ Misses      11137    11098      -39     
- Partials     7222     7243      +21     

see 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added the commit-queue Add this label to land a pull request using GitHub Actions. label May 28, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 29, 2025
@nodejs-github-bot nodejs-github-bot merged commit 7ce82ad into nodejs:main May 29, 2025
73 of 74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 7ce82ad

@RaisinTen RaisinTen deleted the test-account-for-truthy-signal-in-flaky-async_hooks-tests branch May 29, 2025 08:54
targos pushed a commit that referenced this pull request May 31, 2025
When the spawned child process gets closed with a signal, the exit code
is not set and that is why the exit code assertion was failing. This
change adjusts the test to check the signal and if it is truthy, it
doesn't assert the exit code and instead logs the signal and continues
the rest of the assertions.

Refs: #58463 (comment)
Refs: #58199
Refs: #58463
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58478
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
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.

RaisinTen added a commit to RaisinTen/node that referenced this pull request Jun 6, 2025
This change skips asserting the exit code of the child process with the
corrupted async hooks stack only on those platforms where termination
via a signal has been observed.

Refs: nodejs#58478 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Jun 8, 2025
This change skips asserting the exit code of the child process with the
corrupted async hooks stack only on those platforms where termination
via a signal has been observed.

Refs: #58478 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58601
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Jun 8, 2025
This change skips asserting the exit code of the child process with the
corrupted async hooks stack only on those platforms where termination
via a signal has been observed.

Refs: #58478 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58601
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Jun 10, 2025
When the spawned child process gets closed with a signal, the exit code
is not set and that is why the exit code assertion was failing. This
change adjusts the test to check the signal and if it is truthy, it
doesn't assert the exit code and instead logs the signal and continues
the rest of the assertions.

Refs: #58463 (comment)
Refs: #58199
Refs: #58463
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58478
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Jun 10, 2025
This change skips asserting the exit code of the child process with the
corrupted async hooks stack only on those platforms where termination
via a signal has been observed.

Refs: #58478 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58601
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants