Skip to content

HDDS-17437. XceiverServerDomainSocket does not release the xceiver count of a connection it rejects at the limit - #11743

Open
smengcl wants to merge 1 commit into
apache:masterfrom
smengcl:HDDS-17437
Open

smengcl wants to merge 1 commit into
apache:masterfrom
smengcl:HDDS-17437

Conversation

@smengcl

@smengcl smengcl commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

XceiverServerDomainSocket.run increments the xceiver count right after accept() and compares it with maxXceiverCount. The only decrement is in closePeer, which the Receiver of an accepted connection calls when it ends. When the limit check fails, the IOException branch closes the peer but does not decrement, so a connection rejected at the limit keeps its unit of the count. The same holds for every other exit between the increment and daemon.start(): an IOException from setting the peer timeouts or from Receiver.create, an OutOfMemoryError from starting the thread, and the generic Throwable branch. Each such exit leaves the count one higher than the open connections for the life of the server, so it accepts fewer than maxXceiverCount afterwards.

This change sets a flag right after the increment and clears it once daemon.start() has handed the connection to its Receiver, which releases the unit in closePeer as before. A finally on the loop body decrements the count when the flag is still set, so every exit between the increment and the hand off releases the unit exactly once. The limit itself is enforced as before. A @VisibleForTesting getter exposes the count for the test.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17437

How was this patch tested?

  • TestXceiverServerDomainSocket.testMaxXceiverCount now closes every connection after the rejection, waits until the server's Receiver threads have ended and asserts that getXceiverCount() is 0. Without the change it fails with expected: 0 but was: 1. Only the limit rejection is exercised; the other exits are covered by code reading.
  • TestXceiverServerDomainSocket (14 tests) and TestLocalChunkInputStream pass locally on macOS with libhadoop; checkstyle is clean.

…unt of a connection it rejects at the limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@smengcl smengcl added the AI-gen label Oct 24, 2026
Copilot AI lite review requested due to automatic review settings October 24, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@jojochuang jojochuang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jojochuang
jojochuang marked this pull request as ready for review October 25, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants