Repository navigation
HDDS-17436. XceiverServerDomainSocket retries a failed accept() at once and spins while the datanode is out of file descriptors #11798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,9 +232,19 @@ public void run() { | |
| // another thread closed our listener socket - that's expected during shutdown, but not in other circumstances | ||
| LOG.info("XceiverServerDomainSocket is closed", ace); | ||
| } catch (IOException ie) { | ||
| // usually when the xceiver count limit is hit. | ||
| LOG.warn("Got an exception. Peer {}", peer, ie); | ||
| IOUtils.closeQuietly(peer); | ||
| if (peer == null) { | ||
| // accept() itself failed, for example with no file descriptor left, and would fail again right away | ||
| LOG.warn("accept() failed. Will retry after 1 second.", ie); | ||
| try { | ||
| Thread.sleep(TimeUnit.SECONDS.toMillis(1L)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be configurable? 1 second is a long wait...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the current fixed 1s, since it 's only to avoid bursting messages to the DN log file in case of DN run out of file descriptors, so I don't expect it will happen frequently, and when it happens, user is expected to tune the file descriptors or investigate whether there is FD leaks, instead of tuning this sleep interval. |
||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } | ||
| } else { | ||
| // usually when the xceiver count limit is hit. | ||
| LOG.warn("Got an exception. Peer {}", peer, ie); | ||
| IOUtils.closeQuietly(peer); | ||
| } | ||
| } catch (OutOfMemoryError ie) { | ||
| IOUtils.closeQuietly(peer); | ||
| // DataNode can run out of memory if there is too many transfers. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.