-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
New undici pool is created on each request #206
Comments
This is a bad bug I should have spotted. Could you send a PR? It'd probably take less time as I'm swamped. |
Thanks for the fast fix! Soryy for not sending the PR, I fell to sleep :D |
Can you double check is the solution works on your end? |
@climba03003 yes, it behaves as expected, today we will deploy it, then I will finally confirm it |
Prerequisites
Fastify version
3.22.1
Plugin version
6.4.0
Node.js version
16.11
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
11.3
Description
proxy will create a new connection pool on each request, which will produce unlimited number of connections to single host and high resource usage (also performance decrease)
https://github.com/fastify/fastify-reply-from/blob/master/lib/request.js#L133
Steps to Reproduce
create proxy:
create target
run
autocannon -r 20 http://localhost:3000/alive -f
then check number of file descriptors (open sockets) both on target and proxy
lsof -a -p <PID> | wc -l
Expected Behavior
Since number of connections is limited to 10 per origin (host), expected limited number of file descriptors(open sockets), but the number continue to grow to thousands
fastify-reply-from should use build-in
request
function implemented in undiciit uses
Agent
singleton with a single pool per hostp.s with plugin 5.x it works as expected
The text was updated successfully, but these errors were encountered: