-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix(cli): hangs on retrieving notices #19967
Conversation
In an environment where DNS resolution works but network packets may be dropped, the CLI can hang for up to 15 minutes trying to refresh notices. We tried to set a timeout of 3 seconds on this, but did it in a way that didn't work. Turns out that the `request.on('timeout')` event in NodeJS doesn't actually stop the request: it just notifies the listener that it's been a long time since we saw network bytes, leaving the listener to do with that what they want (potentially show a dialog box to a waiting user or whatever). In our case, we had to do an additional `request.destroy()` to actually stop the request. Without doing this, the Promise would resolve correctly and the CLI would continue, but the actual HTTP request would still be going on in the background, preventing Node from shutting down. This PR also changes the behavior of reporting a download failure: it used to be that we would successfully resolve to a `[]` response if the HTTP request failed (which would then be cached). Instead, after this change we reject the Promise if anything goes wrong, so that the next invocation will try again. Fixes #19542.
packages/aws-cdk/lib/cli.ts
Outdated
@@ -341,7 +340,7 @@ async function initCommandLine() { | |||
try { | |||
return await main(cmd, argv); | |||
} finally { | |||
await version.displayVersionMessage(); | |||
// await version.displayVersionMessage(); |
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 meant to remain commented? (added dnm again)
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
In an environment where DNS resolution works but network packets may be dropped, the CLI can hang for up to 15 minutes trying to refresh notices. We tried to set a timeout of 3 seconds on this, but did it in a way that didn't work. Turns out that the `request.on('timeout')` event in NodeJS doesn't actually stop the request: it just notifies the listener that it's been a long time since we saw network bytes, leaving the listener to do with that what they want (potentially show a dialog box to a waiting user or whatever). In our case, we had to do an additional `request.destroy()` to actually stop the request. Without doing this, the Promise would resolve correctly and the CLI would continue, but the actual HTTP request would still be going on in the background, preventing Node from shutting down. This PR also changes the behavior of reporting a download failure: it used to be that we would successfully resolve to a `[]` response if the HTTP request failed (which would then be cached). Instead, after this change we reject the Promise if anything goes wrong, so that the next invocation will try again. Fixes aws#19542. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
In an environment where DNS resolution works but network packets may be
dropped, the CLI can hang for up to 15 minutes trying to refresh
notices. We tried to set a timeout of 3 seconds on this, but did it in a
way that didn't work.
Turns out that the
request.on('timeout')
event in NodeJS doesn't actually stopthe request: it just notifies the listener that it's been a long time
since we saw network bytes, leaving the listener to do with that
what they want (potentially show a dialog box to a waiting user or
whatever). In our case, we had to do an additional
request.destroy()
to actually stop the request.
Without doing this, the Promise would resolve correctly and the CLI
would continue, but the actual HTTP request would still be going on
in the background, preventing Node from shutting down.
This PR also changes the behavior of reporting a download failure: it
used to be that we would successfully resolve to a
[]
response ifthe HTTP request failed (which would then be cached). Instead, after
this change we reject the Promise if anything goes wrong, so that the
next invocation will try again.
Fixes #19542.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license