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

[BUG] Unlimited concurrent connections are opened when using http proxy #255

Closed
1 task done
shartte opened this issue Jan 19, 2023 · 3 comments
Closed
1 task done
Labels
Bug thing that needs fixing Needs Triage needs an initial review

Comments

@shartte
Copy link

shartte commented Jan 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am using a http-proxy to connect to a private registry.

(By setting https-proxy = http://someproxy:3128 in npmrc).

When running npm ci, I run into "503 too many connection" errors. After investigating, it turns out that the maxsockets option which npm passes to this lib has no effect if a proxy is used. I verified this by setting DEBUG=https-proxy-agent:agent and running npm:ci. I can observe that the library opens 1700+ connections before the first one is closed again.

Expected Behavior

I'd expect the library to respect maxsockets when using a HTTP proxy.

Steps To Reproduce

  1. Use any http proxy with a connection limit
  2. Run npm ci (or any other large resolve action)
  3. Observe the connection limits being exceeded

Environment

  • npm: 9.3.1
  • Node: v18.13.0
  • OS: Windows (this happens on Linux / our CI/CD too)
  • platform: Dell Laptop & CI/CD Servers
@shartte shartte added Bug thing that needs fixing Needs Triage needs an initial review labels Jan 19, 2023
@shartte
Copy link
Author

shartte commented Jan 19, 2023

Some more information:

This used to happen pre NPM 6, but was intermittently fixed in NPM 6. When we tried updating to Node 16 (with the associated NPM update), this started happening again. Since Node 14 (the last version with an old enough NPM where this doesn't happen) is out of support soon, we have to update now, but this issue is causing all of our builds to fail since our corporation uses a privoxy to whitelist URLs from within the build environment. That proxy has a connection limit of about 1000, which our NPM installs exceed easily after upgrading past Node 14.

My current analysis is: make-fetch-happen / pacote except https-proxy-agent to take care of the per-origin connection limit, but that package doesn't implement any limiting.

@wraithgar
Copy link
Member

This is a known issue and is being addressed by npm/statusboard#584

@shartte
Copy link
Author

shartte commented Jan 19, 2023

Is there any known workaround for this problem?

also: the linked issue doesn't explicitly list respecting the connection limit in the exit criteria :-| (just in the comments)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs an initial review
Projects
None yet
Development

No branches or pull requests

2 participants