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
Make accept() ENFILE stop spamming the log #71
Comments
It would be useful if the listener would report back such error to the application, which can handle the situation (e.g terminating). Something like this:
This change will break old code - probably needs more thinking. |
I'm still waking up, but is the current error callback that you can set on an evconnlistener with evconnlistener_set_error_cb() not adequate for what you describe? It doesn't receive an address, but in the case of an error, I believe no address is available. |
The error callback is much better then the hack I suggested. Can you get errno value in this callback? |
Ok, the example in the libevent book show that it should work. So the only issue here is not spamming the logs. |
Looking at the code, I think there is no issue here - you get a warning only if you did not register an error handler.
If you do not like these warnings, register an error handler. |
Okay. So, any reason not to close this ? |
I don't see one :-) |
On libevent-users, Adrian Chadd and Oleg Moskalenko report that it's annoying to have evconnlistener report ENFILE over and over when the file table is full. And it is!
There's a workaround, where you set the error handler for the listener to disable the listener if the error was ENFILE, and the you re-enable the listener once you've closed a socket or a few seconds have gone by or something.
There's another "workaround", where you use the logging functions to make it so that log callbacks don't go to stderr. But that's not much comfort.
What can Libevent do better here on its own? Rate-limiting logs could be an option, I guess, though I hesitate to step in that direction.
Documenting the first workaround above might also rock. (Also, we should test to make sure that it works before I go and claim that it's what people should be doing.)
The text was updated successfully, but these errors were encountered: