-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
test: fix flaky test-async-wrap-uncaughtexception #16692
test: fix flaky test-async-wrap-uncaughtexception #16692
Conversation
For some reason, the `beforeExit` event listener is being called multiple times. Not entirely sure why that is, but for now, try using a once handler to fix the flakiness in CI
Stress test on |
In spirit, this seems similar to the resolution that @Trott proposed — since we're not investigating or fixing the root cause, could we add a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM — nice descriptive comment too 👍
@Trott ... PTAL! Stress test is good. |
This is the same approach I took in #16598 and I closed that because this conceals the bug and it may never get fixed if we go this route. I'd prefer we mark as flaky instead (so we at least get a yellow until a genuine fix), or even better, I'd prefer that we direct a ton of resources towards finding and fixing this bug... I won't block this or anything, but it's not my preferred approach for the reasons described above. |
With the TODO comment that @apapirovski, I'm more OK with this. :-D |
I think whichever route we go, I would like this comment to make it in because it clearly outlines why the test is flaky and what needs to be investigated. I think it's helpful both for existing contributors but also for anyone that's new and looking for something to work on. |
@Trott ... to be honest, I'm not sure it is a bug. There is nothing that says |
@nodejs/collaborators ... PTAL. I'd like to get this landed early so we can unbreak CI. |
Right, and we all know that if this PR lands we won’t ever find out why that’s happening. ;) If CI is broken because of something we don’t understand but that also isn’t a total deal breaker, that’s basically what marking tests as flaky is for, right? |
process.on('beforeExit', common.mustCall(() => { | ||
// TODO(jasnell): This is using process.once because, for some as yet unknown | ||
// reason, the 'beforeExit' event may be emitted more than once | ||
// under some conditions on variaous platforms. Using the once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: various
I am dipping into uncharted territory here, apologies if this is off the mark. I agree with @jasnell that this is likely not a bug. The question is, what asynchronous task is being scheduled which may cause Edit: I think this PR should be reopened because |
@lance You might be right in that it should make |
Should being the operative word here. As I read the code, there is likely a race condition created by the task queue addition in |
@addaleax Maybe this isn't the right place to do this, but I would really like to understand better what you mean. I took a look at the code that you reference, and it's not clear to me why
Perhaps the race condition is that if |
@lance ... the "magic" occurs within |
@lance @jasnell I really wouldn’t think this has anything to do with this issue, the microtask queue and the libuv queue are entirely separate things. Here’s a stress test just to make sure: https://ci.nodejs.org/job/node-stress-single-test/1534/nodes=win2012r2-mp-vcbt2015/ Edit: Same config, but for master, just to get an idea of how flaky the test currently is: https://ci.nodejs.org/job/node-stress-single-test/1539/nodes=win2012r2-mp-vcbt2015/ |
assert.deepStrictEqual(call_log, [1, 1, 1, 1]); | ||
})); | ||
// assert.strictEqual(typeof call_id, 'number'); | ||
// assert.deepStrictEqual(call_log, [1, 1, 1, 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the call_log
logging, but why comment these out? They won't get executed twice now because of the process.exit(1)
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just for testing... not planning on keeping this commit
For some reason, the
beforeExit
event listener is being calledmultiple times. Not entirely sure why that is, but for now, try
using a once handler to fix the flakiness in CI
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test