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
Allowing EMFILE in acceptNewConnection #830
Comments
This sounds like a bad idea to me, I disagree with @domenkozar here. Looking at the proposed patch, let me compare current vs proposed behavior: Current: if the FD limit is set too low, the main Proposed: instead of exiting, the Warp thread and process will run in a busy-loop hoping that an FD clears up so that it can accept a new connection. CPU usage will be high, the throughput of the application low (due to limited FDs), and there will be no evidence in the logs or alerts from automated systems to indicate something is wrong. Basically, I don't see a problem that should be fixed in Warp. The program crashing because of insufficient FDs is a Good Thing IMO. |
That's not the current behavior: the process will print the error and not accept new connections according to my observation. If it did crash that would be fine.
Why would it busy-loop, it should try to handle new connection, opening a socket fails and that should be handled but not retried? |
You're right. I think that's the bug, not the fact that it doesn't retry.
I'm commenting on the implementation in @kazu-yamamoto's PR. I'm not sure what behavior you'd expect to see besides busy-looping. The server will repeatedly try to accept new connections regardless of how many open FDs are available until an existing connection closes and an FD is freed up. |
I'm not familiar with the code so I can't comment about what's in the PR but: If a new client connection comes in, then FD error pops up, which is logged and that connection is closed. I don't see how it could busy-loop? |
Relating to #553. |
@snoyberg Is the following the intended behavior?
And do you categorize |
Yes, that sounds right @kazu-yamamoto. I think perhaps we should go to a whitelist of "recoverable errors" and default to treating errors as unrecoverable. |
I gave this a bit more thought and I don't think stopping the accept loop is the best way to handle this. Consider the scenario of hitting the limit for just a fraction of connections being handled, then you're giving up 99% of connections because the server couldn't handle 1%. I see two solutions here:
|
Currently running into this now. If warp ever gets an exception for too many open files, it just refuses all future connections, irrespective of whether load has decreased. I have tried increasing the ulimit but to no avail. |
Thank you for the verification. |
#831 has been merged and a new version is released. |
This change created busy-looping problems, see #928. |
As @domenkozar described in haskell/network#493, the following error can happen:
This is
EMFILE
.@snoyberg I think
eMFILE
should be also allowed inRun.acceptNewConnection
. What do you think?The text was updated successfully, but these errors were encountered: