| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A network error such as `ECONNRESET` while streaming the download and extraction of the CodeQL bundle terminated the `init` Action rather than falling back to downloading the bundle before extracting it, since no `error` listener was attached to the request returned by `https.get`. Also pipe the response into `tar` using `stream.pipeline` so that errors on the response itself are surfaced and `tar`'s standard input is closed, and abort the request if it stalls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
Sorry, something went wrong.
There was a problem hiding this comment.
Nice, thanks for improving this!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When we stream the download and extraction of the CodeQL bundle, a network error such as ECONNRESET terminates the init Action rather than falling back to downloading the bundle before extracting it. This is because we never attached an error listener to the request returned by https.get, so follow-redirects emits the error as an unhandled error event, which is fatal. See #3367.
Attaching the listener is enough to turn the crash into the fallback path we already have. This PR also switches the pipe from the response into tar over to stream.pipeline, since tar.pipe(stdin).on("error", ...) only listens for errors on tar's standard input: an error on the response itself was unhandled, and would have left tar waiting indefinitely on a pipe that was never going to be closed. Finally, we abort the request if it stalls for five minutes so that a hung connection can't take the whole job with it.
I've deliberately not added a retry loop around the streaming attempt: toolcache.downloadTool, which we fall back to, already retries three times with exponential backoff and already avoids retrying non-transient status codes. The bug here was never that we don't retry, it's that we crashed before we got the chance.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
Products:
Environments:
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist