-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Immediately close bad connections to prevent file exhaustion
osrm-routed does not immediately clean up a keep-alive connection when the client closes it. Instead it waits for five seconds of inactivity before removing. Given a setup with low file limits and clients opening and closing a lot of keep-alive connections, it's possible for osrm-routed to run out of file descriptors whilst it waits for the clean-up to trigger. Furthermore, this causes the connection acceptor loop to exit. Even after the old connections are cleaned up, new ones will not be created. Any new requests will block until the server is restarted. This commit improves the situation by: - Immediately closing connections on error. This includes EOF errors indicating that the client has closed the connection. This releases resources early (including the open file) and doesn't wait for the timer. - Log when the acceptor loop exits. Whilst this means the behaviour can still occur for reasons other than too many open files, we will at least have visibility of the cause and can investigate further.
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters