[#755] wait for the LDAP listener after in-process server (re)start#756
Merged
vharseko merged 1 commit intoJul 21, 2026
Conversation
…rocess server (re)start BindOperationTestCase.testSubtreeModifyUpdatesAuthInfo failed once on CI with "Connection refused" on the first RemoteConnection right after TestCaseUtils.restartServer(): the wait-for-listen handshake in LDAPConnectionHandler.start() used a bare waitListen.wait() with no condition predicate, so an early wakeup let startup return before the listen channel was bound. - LDAPConnectionHandler: guard the wait with a listenAttempted predicate set at both notify sites, and restore the interrupt flag on interrupt - TestCaseUtils: poll the LDAP port until it actually accepts TCP connections after server.start() in startServer()/restartServer(), covering all tests that connect right after a restart
maximthomas
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #755.
Problem
BindOperationTestCase.testSubtreeModifyUpdatesAuthInfofailed once on CI withjava.net.ConnectException: Connection refusedon the very firstRemoteConnectionopened right afterTestCaseUtils.restartServer(). The wait-for-listen handshake inLDAPConnectionHandler.start()used a barewaitListen.wait()with no condition predicate, so an early wakeup (spurious wakeup or interrupt) could let server startup return before the listen channel was actually bound — the first client connection then raced the bind and got refused.RemoteConnectionconnects exactly once, with no retry.Fix
LDAPConnectionHandler(root cause): guard the wait with alistenAttemptedcondition predicate set at both notify sites inrun()(afterregisterChannels()and in the!enabledstartup branch), keeping the existing "notify in any case" semantics. Also restore the thread's interrupt flag when the wait is interrupted.TestCaseUtils(test-side hardening): afterserver.start()in bothstartServer()andrestartServer(), poll the LDAP port with a probe socket (TestTimer.repeatUntilSuccess, up to 10 s in 100 ms steps) until it actually accepts TCP connections. This covers all 13 test files that callrestartServer()and connect right after, not just the two tests from the issue.Testing
mvn -pl opendj-server-legacy verify -P precommit -Dit.test=BindOperationTestCase#testSubtreeDeleteClearsAuthInfo+testSubtreeModifyUpdatesAuthInfo— 2 tests passed, 2 in-core restarts exercised (both the initial-start and restart paths went through the new listener wait).