-
Notifications
You must be signed in to change notification settings - Fork 16.5k
fix: possible timing issue in utility-process spec #45690
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
This fixture has been calling process.exit() immediately after writing to stdout and stderr, which the Node.js docs say is risky behavior: > Calling process.exit() will force the process to exit as quickly as > possible even if there are still asynchronous operations pending that > have not yet completed fully, including I/O operations to > process.stdout and process.stderr. This fixture's been around for years without problems (AFAIK). The writes are very small ('hello\n' and 'world') and finish quickly. But recently I've been testing on a very slow CI machine. There, I see this spec flaking when it expects stderr to be 'world' but it gets ''. This PR changes the fixture to wait for stdout & stderr to flush before calling process.exit().
With that invitation, seems more like a |
No Release Notes |
I have automatically backported this PR to "32-x-y", please check out #45726 |
I have automatically backported this PR to "35-x-y", please check out #45727 |
I have automatically backported this PR to "34-x-y", please check out #45728 |
I have automatically backported this PR to "33-x-y", please check out #45729 |
This might have something to do with it working on so many machines: #44174 |
Follow up issue because this will happen in real apps, too: #47228 |
Description of Change
This fixture has been calling process.exit() immediately after writing to stdout and stderr, which the Node.js docs say is risky behavior:
This fixture's been around for years without problems (AFAIK). The writes are very small (
'hello\n'
and'world'
) so they finish quickly. But recently I've been testing on a very slow CI machine. There, I see this spec flaking when it expects stderr to be'world'
but it gets''
. This PR changes the fixture to wait for stdout & stderr to flush before calling process.exit().I've read through the specs that touch
log.js
and AFAICT this fix doesn't change the semantics of any of spec, e.g. none of them are looking for an unfinished write().Yes, I'm changing a three-line .js file. Bikesheds welcome. 😸
Checklist
npm test
passesRelease Notes
Notes: none