Skip to content
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

Yarn install ECONNREFUSED 151.101.36.162:443 issue (proposed fix) #5299

Open
Xerios opened this issue Jan 31, 2018 · 12 comments
Open

Yarn install ECONNREFUSED 151.101.36.162:443 issue (proposed fix) #5299

Xerios opened this issue Jan 31, 2018 · 12 comments

Comments

@Xerios
Copy link

Xerios commented Jan 31, 2018

I've been getting some strange ECONNREFUSED errors when trying to use yarn or npm inside Docker ( and Docker edge build ), an issue that is somehow still unknown of origins.

What is the current behavior?

When doing an yarn install/add or npm install, you start seeing ECONNREFUSED 151.101.36.162:443 on random packages. Verbose output shows that once the first ECONNREFUSED error happens, all the following requests will start failing with the same reason. Note that the error happens randomly on any package, there is no specific package or url causing it as far as I know.

Steps to reproduce.

It's pretty hard to reproduce, and from reading other people's similar issues, it doesn't seem to be related to the OS. One odd behavior I have noticed, is that, using the same machine with the same setup, I do NOT get this issue when I'm connected my work's network ( physically in a different place ), but I do get it at home. My friend's (windows) PC, which's also connected to the same home network as me, does not get this problem, but both of my own PCs do (both windows).

What is the expected behavior?

Yarn install should simply install the packages just like it's supposed to.

Solution

Setting an argument --network-concurrency=1 solves this issue entirely.

Proposed change

In case of consecutive ECONNREFUSED errors, falling back to network-concurrency=1 with a delay would solve this for me and many others. Perhaps a message proposing this argument is gonna prevent users from getting this confusing error.

Tested this issue on these following systems:
Happens with yarn(1.3.2) and npm (5.6.0) and possibly older versions.
Node 9.2, 8.9 and Node 6.x.
Windows 10 ( cleanly installed build 16299 and an existing 17074 build ) with Docker CE ( older version 16.x, stable 17.12.x and edge 18.01.0 )

To do later

I'll test yarn again with 1.4.0 later this evening to see if this issue persists.

@ghost ghost assigned arcanis Jan 31, 2018
@ghost ghost added the triaged label Jan 31, 2018
@BYK
Copy link
Member

BYK commented Jan 31, 2018

Thanks a lot for creating a new issue with all these details! I still think this is due to slow/overwhelmed DNS but that doesn't explain why the DNS cache doesn't help.

I think we need this patch to be merged: https://github.com/yahoo/dnscache/pull/6/files

Seems unlikely that the maintainers will do anything with the package so maybe we should fork it into @yarnpkg and publish under our own scope?

@Xerios
Copy link
Author

Xerios commented Feb 1, 2018

Just tested and I can confirm that this issue is still present in yarn 1.4.0.

Unfortunately, my company won't accept having a forked yarn inside their system and it's a really low priority issue for me, since it only happens to me when working remotely through my home network, plus the fact that I'm the only person there who experiences this.

@BYK
Copy link
Member

BYK commented Feb 2, 2018

Unfortunately, my company won't accept having a forked yarn inside their system and it's a really low priority issue for me, since it only happens to me when working remotely through my home network, plus the fact that I'm the only person there who experiences this.

Oh, I wasn't referring to forking Yarn :) I was saying we may need to fork yahoo/dnscache, release a new version of it inside the @yarnpkg scope on npm and use that from Yarn and release a new official Yarn version.

Makes sense?

@mhchen
Copy link
Contributor

mhchen commented Feb 9, 2018

@BYK I could take this on with some support, as I've never published an npm package before. Would you like me to take a look? If so, does it make sense for you to start by forking https://github.com/yahoo/dnscache/ within the yarn Github org?

@ssgtcookie
Copy link

Still present on the latest version.

@1459416736
Copy link

@Xerios I also get the same error as you

@BYK
Copy link
Member

BYK commented May 3, 2018

@mhchen it is probably easier than you think :) If you are interested, give it a shot?

@mhchen
Copy link
Contributor

mhchen commented May 4, 2018

@BYK Will do, would you mind please forking https://github.com/yahoo/dnscache/ into https://github.com/yarnpkg/dnscache/ (if that's the optimal way to handle this)?

@Xerios
Copy link
Author

Xerios commented May 9, 2018

@1459416736 Tell us if --network-concurrency=1 fix solves this issue and perhaps provide more details, this would help whichever brave soul is ready to tackle on this problem.

Truth to be told, I haven't had this error for a while now. Unfortunately, I can't pinpoint when it was fixed since I was working on non-node projects for a while now.

Perhaps it was fixed through my latest windows insider build ( 10.0.17661.1001, I'm sure it also worked few releases before this one ), or one of the newer Docker CE versions I installed ( 17.12.0-ce, build c97c6d6 ).

@a1mersnow
Copy link

@Xerios it works for me

@Grohden
Copy link

Grohden commented Jul 20, 2018

Got this issue today, everything was working fine yesterday, but then today yarn says:

Nope, it's friday, i'm not working on friday, go home!

I'm on windows and my yarn version is 1.5.1, node is v8.10.0.
--network-concurrency=1 worked for me, but why i need it now ? why it was working without that?

I can provide any needed details if it helps to solve this issue...

@locinus
Copy link

locinus commented Jun 1, 2021

Docker 20.10.6
Node 16.2.0
Yarn 1.22.5

I encounter the same problem, while installing packages with yarn in a Dockerfile.
The problem is seldom though, which is very confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants