-
Notifications
You must be signed in to change notification settings - Fork 29.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
"max socket lifetime" Agent impacted by v13.11 socket timeout changes #33111
Labels
http
Issues or PRs related to the http subsystem.
Comments
cc: @ronag |
So basically we should move:
into the default |
3 tasks
targos
pushed a commit
that referenced
this issue
May 4, 2020
Previous location of setting the timeout would override behaviour of custom HttpAgents' keepSocketAlive. Moving it into the default keepSocketAlive allows it to interoperate with custom agents. Fixes: #33111 PR-URL: #33127 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Andrey Pechkurov <[email protected]>
ronag
pushed a commit
to nxtedition/node
that referenced
this issue
May 10, 2020
Previous location of setting the timeout would override behaviour of custom HttpAgents' keepSocketAlive. Moving it into the default keepSocketAlive allows it to interoperate with custom agents. Fixes: nodejs#33111 PR-URL: nodejs#33127 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Andrey Pechkurov <[email protected]>
abhishekumar-tyagi
pushed a commit
to abhishekumar-tyagi/node
that referenced
this issue
May 5, 2024
Previous location of setting the timeout would override behaviour of custom HttpAgents' keepSocketAlive. Moving it into the default keepSocketAlive allows it to interoperate with custom agents. Fixes: nodejs/node#33111
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a desire to limit the overall lifetime of a socket used for http keep-alive, we've done this with a simple (possibly non-ideal) agent implementation that looks similar to below:
Expand to see HttpAgent implementation
The overall approach:
Which has served us fairly well, and I believe similar mechanisms exist in more featureful "keep-alive agent" node modules.
The built-in agent started trying to handle some of this behaviour in 13.11 (8700d89#diff-5f7fb0850412c6be189faeddea6c5359 #32000) by setting its own timeout listener (removing the need for our agent's
onTimeout
), but also by resetting the socket's timeout just before re-inserting it into the freelist. Unfortunately thissetTimeout
proceeds the call tokeepSocketAlive
, overriding the behaviour we've implemented.The documentation on the agent's overridable hooks doesn't necessarily describe what may happen before or after them, but this is something we'd like to be able to maintain.
I may be able to follow up with a PR in the next few days. My first thought would be to move the agent's built-in timeout reset be moved into the default
keepSocketAlive
function.Thanks!
The text was updated successfully, but these errors were encountered: