Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix TCP accept handling when max incoming connection limit is reached #3315

Merged
merged 18 commits into from
Jun 2, 2021

Conversation

dsiganos
Copy link
Contributor

This fixes the problem where we stop accepting TCP sockets permanently due to reaching the max incoming sockets limit.
The symptom of this problem is a large number of CLOSE_WAIT TCP sockets.

The approach of this solution is to never refuse to accept.
We accept all connections but if the limit is reached, the connection is dropped immediately after being accepted.

Matthew King and others added 18 commits May 28, 2021 12:38
We do not currently need a system/permanent error concept in server_socket
and we may never need it. We can introduce it if we ever need it.
I don't see how connection aborted is a temporary error.
Connection aborted is a permanent state.
We never want to stop listening for incming sockets
…500ms)

At 500ms, it means that if connections arrive at a frequency higher than
2 per second, they will start backing up and we will start seeing
CLOSE_WAIT socket poling up because the client will close the socket but
the the node cannot close a socket it has not accepted yet.

At 1ms the incoming connection request frequency would have to be higher
than 1000 per second so that's probably OK. If we get 1000 connection
requests per second per server then we will other problems.
This is to avoid busy loops in case something goes wrong and we get a
persistent error.
@dsiganos dsiganos requested a review from clemahieu May 28, 2021 12:03
@MajorChump MajorChump mentioned this pull request May 28, 2021
@clemahieu clemahieu merged commit 17e7687 into nanocurrency:develop Jun 2, 2021
clemahieu pushed a commit that referenced this pull request Jun 2, 2021
…#3315)

This fixes the problem where we stop accepting TCP sockets permanently due to reaching the max incoming sockets limit.
The symptom of this problem is a large number of CLOSE_WAIT TCP sockets.

The approach of this solution is to never refuse to accept.
We accept all connections but if the limit is reached, the connection is dropped immediately after being accepted.
@clemahieu clemahieu added this to the V22.1 milestone Jun 3, 2021
@zhyatt zhyatt added the bug label Jul 16, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants