-
Notifications
You must be signed in to change notification settings - Fork 2.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
Specify TCP timeout when downloading packages #2950
Conversation
Nice. I think there is huge need to write a test here but what would be your Test Plan for the change? |
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.
lint + test + config
Thanks for feedback! I'll work on it. I wish |
Start with a manual Test Plan and think if this could be automated in some way |
It could be an e2e test with http requests mocked |
dfeb004
to
8fa1482
Compare
@bestander fixed lint, added the config option and the unit test 🎉 Random tests are failing on the CI but I can't reproduce them locally with the same version of node. Taking the fact that CI for master is also red, I assume the test suite is not 100% stable. |
@bestander please let me know if there's something else I can improve. |
CircleCI is now green 🎉 |
@kirs - thanks for this. Would love to see this merged in soon. |
Great work, @kirs. |
Happy to see it merged! @bestander in my implementation timeout errors are considered the same as other networking errors and they will be retried: yarn/src/util/request-manager.js Line 348 in b2c2c3b
yarn/src/util/request-manager.js Line 281 in b2c2c3b
|
@casperisfine @stefanmb in case you've been wondering about Locutus builds stuck on |
It's been an old and annoying bug: yarn doesn't specify
fetch
timeout when downloading packages, causingyarn install
to hang forever on network issues.Steps to reproduce
Point
yarn.lock
to uselocalhost:8888
as a host for package registryRun
yarn install
and see the process hangingThe issue has been reported multiple times and it's a very easy fix; I'm surprised that I'm the first one to look into it. As mentioned in the
fetch
documentation, "requests to external servers should have a timeout attached".Specifying timeout is a critical thing for distributed software and build tools. Earlier this week we found our build servers hanging on
yarn install
step for 40 minutes until it was hard killed. It took us a while to find that it was a network problem with connectivity between EC2 andregistry.yarnpkg.com
. Having thefetch
timeout would help us to discover the issue and see the timeout error, as well as not causing build servers to hang until a hard kill.fixes #764, #1289, #2351
@bestander