Skip to content

DIRSTUDIO-1295: Send an UnbindRequest when closing a connection - #128

Open
zx97 wants to merge 1 commit into
apache:masterfrom
zx97:fix/DIRSTUDIO-1295-unbind
Open

zx97 wants to merge 1 commit into
apache:masterfrom
zx97:fix/DIRSTUDIO-1295-unbind

Conversation

@zx97

@zx97 zx97 commented Dec 3, 2026

Copy link
Copy Markdown

JIRA: https://issues.apache.org/jira/browse/DIRSTUDIO-1295

ConnectionWrapper.unbind() only closed the socket, so the server never received an UnbindRequest and kept the session until it timed out. unbind() now sends the UnbindRequest before closing the socket, so the server logs a clean close.

LdapNetworkConnection.unBind() waits until the server closes the session, up to the connection timeout. I lower the timeout to 1 s for that call, so closing a half-dead connection cannot block a job for 30 s; the socket is closed right after in any case.

Tests:

  • UnbindOnWireTest (new): with a local socket and no LDAP server at all, checks that unbind() emits the UnbindRequest bytes (30 05 02 01 .. 42 00) and that a plain disconnect() emits nothing.
  • testUnbind in DirectoryApiConnectionWrapperTest: against the configured servers, the connection is closed and a second unbind() call is harmless.

Full build and tests pass with Maven 3.8.8 / JDK 17 against ApacheDS.

unbind() only closed the socket, so the server never received an
UnbindRequest. Send it before closing. LdapNetworkConnection.unBind()
waits until the server closes the session, so the timeout of the
connection is lowered for that call: closing a connection must not hang.

The UnbindRequest is checked on the wire with a local socket, and
unbind() is also covered against the configured servers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant