-
Notifications
You must be signed in to change notification settings - Fork 13
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
set 1s delay for untar pipes to avoid spawn racing #38
Conversation
0ee2a78
to
bd02cbe
Compare
@@ -14,7 +14,7 @@ defaults: | |||
|
|||
jobs: | |||
build: | |||
runs-on: "ubuntu-latest" | |||
runs-on: "ubuntu-20.04" |
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.
Hi, I've created one verify repo with this patch opt-in and CI ready, feel free to take a look if you're interested. https://github.com/imcotton/demo-ci-ps-npm-installer-untar-delay |
Hi @JordanMartinez, I have another minor PR #39 opened, should I keep these two separated or maybe just cherry-pick the commit over here? |
Keep them separate. |
I don't think this fixes the root cause of the issue.
What is the root cause that causes this issue and does this PR solve that issue? If |
I was doing a little sniffing around here to see if I can figure it out. I can say that if everything in #33 is kept except for the dependency change from I'm not sure what to make of this yet; there does seem to be a whoooooole lot of buggy code floating around dealing with how streams work, both in the Node internals at various versions and in the NPM ecosystem at large, not to mention a fair amount of confusion between the different types of streams that Node started supporting at different points in time. Reverting back to Edit: We could also vendor |
1 second has whole a lot of margin here, I suspect it will be good enough even by To my understanding, at the worse case this change only adding 1 second delay to the installation process, thus I'd like to get some feedback from @mrskug and @sjpeterson on the patch as cross verify. A side from baggage of this code base itself, this is a tricky issue if you'd like to digging into the root, which involving: scheduling between microtasks & macrotasks, back-pressure of stream piping, non-blocking I/O to the kernel, etc..., which I'm out bandwidth at the moment unfortunately. |
Okay, I got it. The package download and extract is being triggered twice with the new code, because there's a I have no idea what the See #40. |
Someone close this? |
In previous PR #33, the outdated dependency pump 1 has been replace by native streams pipeline 2, which intended to be drop-in replacement given ported by its original author (nodejs/node#19828).
It seems to flaky for some Docker related setups (i.e. computing resources intensive, caching), since it has a lot of moving parts (node & npm versions) involved, I'd like to patch with this minimal changes by having 1 second delay before the untar pipe proceed to its next tasks.
To preview & verify, for Node.js version >= v16 (shipped with npm v8) could use the
overrides
syntax to select this patch by modify thepackage.json
:For Node.js v14 consider adding an extra step in
Dockerfile
to upgrade builtin npm to v8 firstresolves #37
/cc @mrskug @sjpeterson @rhendric
Footnotes
https://github.com/mafintosh/pump ↩
https://nodejs.org/docs/latest-v14.x/api/stream.html#stream_stream_pipeline_streams_callback ↩