-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
npm ERR! Exit handler never called! #6409
Comments
I'm getting the same on macOS with NPM version 9.6.5 running
when I check the log file it's empty. |
I get the same error when trying to create a new gatsby project
Edit: Despite getting this error I can run npm update and npm run develop to start the project Npm 9.6.5 Node v. 20 |
Same in our repositories: https://github.com/netlify/cli/actions/runs/4875634980/jobs/8698093846 happened since Github Action started using node 20 and npm 9.6.4 |
I have received the same error message when attempting to install Netlify's CLI:
System environment:
|
We are experiencing this intermittently within our CI, which is running a
This started when we upgraded from |
We are running npm 8.1 with Nodejs v16.3, We are seeing this same messaeg when tryiing to run npm login to connect with our JFrog SaaS artifactory for building our artifact. We had done no other code changes up to that point:
npm ERR! This is an error with npm itself. Please report this error at: npm ERR! A complete log of this run can be found in: |
When we reverted our CI to use
So for us, it seems like either Node 20 or npm 9.6.x (or the combination) is causing our failures. |
We've been hitting this too, and after much debugging I think I figured out why. The issue seems to be caused by the new auto select family stuff in Node 20. If I run with How the bug manifests to cause this is a bit convoluted, but here goes:
The fix in nodejs/node#47860 looks like it will mostly address this issue. I am concerned about one additional case though. If you consider there are two IPs to connect to, the first of which times out, the second of which fails, then I think I think to address that, the |
@dharesign Thanks for the deep analysis. I can confirm the behavior was broken, especially with TLS. Several PR have landed on main now, so they will be likely release in 20.3.0 or 20.4.0. |
Just from a code analysis point of view, I don’t think it has. The handle reinitialization is still below the error-and-retry block, so it won’t happen if the connect attempt errors for any connection other than the first, leaving The desire seems to be to have Not sure how testable/mockable all this is in CI, but it would be good to have a test for the case I mention:
|
We don't care about reinitializing the socket if there is no active connection. In which case you might need anything like that?
This is now tested in test/internet/test-https-autoselectfamily-slow-timeout.js
This is now tested in test/parallel/test-net-autoselectfamily.js
What do you mean? A single address in the resolution? In that case the multiple attempt logic is completely skipped.
If you're talking about a |
The case I describe is having a domain resolve to two addresses. The first address succeeds connecting but after the timeout, and the second address fails with an error. If we look through the code we can see what will happen in this situation:
If you compare the above with what happens when there's a single connection, the handle never gets closed in
|
It seems to me that the desire is that there's really only ever a single handle open at any given point in time. Rather than waiting until a successful connection from IP 2 - N, and then updating My original suggestion was to move the handle reinitialization above the error check in I think the handle reinitialization should therefore move into |
If the first connection is successful, but only after the connect timeout, and all subsequent connections result in an error, the socket will not emit the 'close' event, causing issues in places like 'http's 'Agent' which rely on the 'close' event to free up sockets. This commit moves the reassignment of '_handle' to happen as soon as a new connection is attempted, so that if the socket is destroyed, the '_handle' will represent the last connection attempt (even if it resulted in an error) and closing the handle will then cause the 'close' event to be emitted. See npm/cli#6409 for more background.
Hi @dharesign! |
PR-URL: #48464 Fixes: npm/cli#6409 Fixes: KararTY/dank-twitch-irc#13 Fixes: #47644 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
PR-URL: nodejs#48464 Fixes: npm/cli#6409 Fixes: KararTY/dank-twitch-irc#13 Fixes: nodejs#47644 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
PR-URL: nodejs#48464 Fixes: npm/cli#6409 Fixes: KararTY/dank-twitch-irc#13 Fixes: nodejs#47644 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
@ShogunPanda this is still broken in node v22.3.0, npm v10.8.1 for "npm publish" on a machine with both ipv4 and ipv6. |
yeah +1 this npm works in bizarre way |
npm ERR! Exit handler never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://github.com/npm/cli/issues
The text was updated successfully, but these errors were encountered: