[BUG] Fixed desynch between deleted socket and unsubscribing from epoll (misleading log flood) #3090
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was sometimes reported a log, sometimes with lots of flooding, which complained about event update on a socket that could not be identified. This was happening due to that a socket, which's ID has been already removed from the dispatch table, was trying to update the readiness state in epoll. Finding an already closed socket was impossible, while it was done as the last chance update so that the application picks up the error. This wasn't possible to be done simply because epoll system could not find the socket anyway.
The change was done so that the socket is immediately removed from the epoll system when it's going to be removed from the dispatch table. Note that epoll cannot operate on nonexistent sockets, so it cannot set it any readiness state if it's already closed. Hence removal is done before closing. In the place where the controversial update was done the removal was repeated, just in case, although the socket should be at that moment unsubscribed from any epoll.