-
Notifications
You must be signed in to change notification settings - Fork 263
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
Warp exits after accepting too many simultaneous connections on Linux #825
Comments
The server can't respond with a 429 in that case, since it cannot accept the new connection at all. I'd strongly advise bumping the FD limit, 1024 is far too low for a busy server. |
Well, it is not necessarily a busy server. It could be just someone trying to abuse it. |
@cuklev Could you please provide client-side code you're invoking? |
|
Seems that you're running out of sockets/FDs. Application cannot allocate more than I do not know what is the best strategy for the socket exhaustion fault tolerance here. Maybe add allocation counter, threshold and/or queue and to change its strategy when threshold is reached to schedule responses into the queue and process them separately. As of now, you could go ahead and set soft/hard limits per user/application on system level based on expected/predicted RPS from clients/proxy. |
Yes, increasing the FDs limit will improve the situation but it will not solve it. Warp should definetely catch that error and not exit. |
curlConsider
According to current Let's return to the nginx. NGINXWith
NGINX + Warp + E.g. decreasing |
I think it should be possible to not let the application crash, and just print to stdout/stderr that no file descriptors were available, and just continue with the loop? The |
Might be related to #603
Here is a sample code:
When I run something like
while :; do curl -s http://localhost:3003 > /dev/null & done
the Haskell program receivesNetwork.Socket.accept: resource exhausted (Too many open files)
and then exits successfully after all connections close.It always happens after printing 1011 for me. This is because each accepted connection is a new open file and there is a limit to open files per process.
On my system this limit seems to be 1024 (can be seen or changed with
ulimit -Sn
).I am not sure how this thing should be solved.
Should warp not accept connections when there are too many that have been opened?
Should accepting be allowed to fail and retry after that?
Should the server respond with something like 429 Too Many Requests?
The text was updated successfully, but these errors were encountered: