Repository navigation
HDDS-17436. XceiverServerDomainSocket retries a failed accept() at once and spins while the datanode is out of file descriptors - #11798
Gargi-jais11 wants to merge 3 commits into
Conversation
|
@ChenSammi this is also ready for review. Once you approve I will mark it ready to review so that CI run just once. |
| if (peer == null) { | ||
| // accept() itself failed, for example with no file descriptor left, and would fail again right away | ||
| try { | ||
| Thread.sleep(TimeUnit.SECONDS.toMillis(1L)); |
There was a problem hiding this comment.
should it be configurable? 1 second is a long wait...
There was a problem hiding this comment.
@yandrey321 thes pause only happens when accept() itself throws, suppose when the datanode is out of file descriptors. Normal accepts, idle timeouts, and rejected connections are not delayed. In that state a retry fails again almost at once: without the pause the test saw about 14,600 accept() calls in 500 ms. One second matches the fixed 30-second pause the same loop already uses after an OutOfMemoryError, and Hadoop's DataXceiverServer uses a similar fixed backoff.
@ChenSammi, what do you prefer? I can keep the fixed 1 second, 2.) use a shorter fixed value such as 100 ms, or add a datanode config key for it. A config key seems like more than this case needs, but I'm happy to add one if you think it's useful.
What changes were proposed in this pull request?
When
accept()itself fails inXceiverServerDomainSocket.run, the loop logs a WARN and calls accept() again right away. For example, accept(2) fails with"Too many open files"when the datanode is out of file descriptors. On Linux, the queued connection keeps failing, so the accept thread spins on a CPU core and logs thousands of WARN stack traces per second until descriptors are free again.Changes done:
This change adds a 1-second pause before retrying when accept() itself fails, which is when no peer has been created yet. Rejections of accepted connections, such as at the xceiver limit, and idle accept timeouts behave as before. Shutdown isn't delayed, because stop() interrupts the pause.
KEPT in draft to save CI resources, will mark it ready to review once approved
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17436
How was this patch tested?
added
testAcceptFailureIsRetriedAfterPauseto TestXceiverServerDomainSocket. Without the fix it fails with about 14,600 accept() calls in 500 ms; with the fix it passes.Without fix: (added few lines from test runs)
After fix: