accept()ing when you can’t问题
在libev的官方文档中提到一个accept()ing when you can’t的问题,下面是作者对于这个问题的分析:
For example, larger servers often run out of file descriptors (because of resource limits),causing accept to fail with ENFILE but not rejecting the connection, leading to libev signalling readinesson the next iteration again (the connection still exists after all), and typically causing the program toloop at 100% CPU usage.One of the easiest ways to handle this situation is to just ignore it - when the program encounters anoverload, it will just loop until the situation is over. While this is a form of busy waiting,no OS offers an event-based way to handle this situation, so it’s the best one can do.A better way to handle the situation is to log any errors other than EAGAIN and EWOULDBLOCK,making sure not to flood the log with such messages, and continue as usual, which at least gives the user an idea of what could be wrong (“raise the uli