-
Notifications
You must be signed in to change notification settings - Fork 144
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
agentkeepalive spurious failure #187
Comments
For the love of god please yes. Can recycling free sockets with a timeout option be added to the native agent? I hate depending on this library. In environments with low and slow socket availability (Azure App Services being one of the worst), Node apps are basically unusable at any decent traffic level without proper socket recycling. |
Node.js feature requests should get raised on https://github.com/nodejs/node/issues, I don't think doing it here is going to attract much attention. |
I think we can add this to list for phase 2 as documented here #143 |
@ronag what did you replace it with? We're suffering the same thing. |
@phawxby we use the native keepalive agent. |
Thanks. I'll give that a go and hope Azure doesn't explode. |
Agentkeepalive has a ttl for the socket from the moment of creation. This is useful because a lot of Microsoft servers close sockets after 2 minutes (despite reuse, keep alive, etc. No socket can ever live more than 2 min). The native agent does not have this kind of ttl. |
Not sure if this is the same problem, but I'll give it a go anyway: I have tried both agentkeepalive and the native Agent using HTTP KeepAlive and setting MaxSockets to 160, which I would have thought should limit the no of requests to 160 and not >1000? const agentOptions = {
maxSockets: 160,
maxFreeSockets: 10,
keepAlive: true,
timeout: 30000
}
const httpAgent = new http.Agent(agentOptions)
const httpsAgent = new https.Agent(agentOptions)
const gotClient = got.extend({
headers: headers,
agent: {
http: httpAgent,
https: httpsAgent
}
})
const client = {
get: async (url = '') => {
const response = await gotClient.get(url, {
headers,
json: true
})
return response.body
}
...
} Is there anything I'm missing? Why are we aren't the connections being re-used and why are trying top open >1000 new requests? I've also tried to find a way to log the no of outgoing requests but haven't found a way. @tony-gutierrez , is this similar to your problem? How did you end up solving them? |
I would like to give some attention to a long standing issue in a very popular ecosystem module agentkeepalive (1.5M weekly downloads).
The issue has made no progress for the past year and probably causes a lot of weird, spurious and intermittent failures in the wild where connections can reset just at the start of requests.
We confirmed this ourselves a few months ago and after being unable to fix it we stopped using the module.
I think the community needs a little help on this one.
The text was updated successfully, but these errors were encountered: