Skip to content

[#748] stabilize flaky GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement#749

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-748-flaky-testResourceManagement
Jul 18, 2026
Merged

[#748] stabilize flaky GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement#749
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-748-flaky-testResourceManagement

Conversation

@vharseko

Copy link
Copy Markdown
Member

Fixes #748.

Problem

GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement (regression test for OPENDJ-1156) intermittently times out on the macos-latest, 11 CI matrix job, breaking otherwise-green builds. The test runs 100 iterations, each opening a connection, triggering a remote disconnect(), and waiting up to TEST_TIMEOUT = 30s for the client-side error notification (listener.awaitError(...)).

Root cause

This is delivery latency, not a lost notification. The async connection-error path is correct for every event ordering:

  • CompletionHandlerAdapter.completed() registers LDAP_CONNECTION_ATTR (via registerConnection) before the connection promise is fulfilled, so by the time getConnection() returns and disconnect() is called, the client connection is fully registered and LDAPClientFilter.handleClose() finds a non-null ldapConnectionGrizzlyLDAPConnection.close() fires handleConnectionError.
  • If the failure were observed before the listener is added, addConnectionEventListener() notifies it immediately via the isFailed branch.

Both orderings deliver exactly one notification, so no product code is at fault. On a slow/loaded macOS + Java 11 runner one of the 100 iterations simply exceeded the 30s deadline (elapsed time was 30.08s). 8 of 9 matrix jobs passed — an environment symptom, not a functional regression.

Fix

Raise the shared TEST_TIMEOUT from 30s to 60s. It is a generous upper bound, not an expected duration — in the normal case the awaited latch releases within milliseconds, so this only takes effect under runner slowness and trades a slower failure for far fewer false-negative builds. ITERATIONS stays at 100 to preserve the OPENDJ-1156 race coverage. No product code changed.

Verification

mvn -pl opendj-grizzly surefire:test -Dtest='GrizzlyLDAPConnectionFactoryTestCase#testResourceManagement' → all tests passed.

…FactoryTestCase.testResourceManagement

The async connection-error notification path is correct for every event
ordering, so the intermittent timeout on the macOS/Java 11 CI runner was
delivery latency, not a lost notification: one of the 100 iterations
exceeded the 30s deadline under load. Raise the shared TEST_TIMEOUT from
30s to 60s so a slow runner no longer produces false-negative builds;
ITERATIONS stays at 100 to preserve the OPENDJ-1156 race coverage.
@vharseko
vharseko requested a review from maximthomas July 18, 2026 06:17
@vharseko vharseko added tests Test suites: fixing, enabling, un-disabling CI labels Jul 18, 2026
@vharseko vharseko changed the title Issue #748: stabilize flaky GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement [#748] stabilize flaky GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement Jul 18, 2026
@vharseko
vharseko merged commit 29445ad into OpenIdentityPlatform:master Jul 18, 2026
17 checks passed
@vharseko
vharseko deleted the issue-748-flaky-testResourceManagement branch July 18, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI tests Test suites: fixing, enabling, un-disabling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: GrizzlyLDAPConnectionFactoryTestCase.testResourceManagement times out on macOS/Java 11

2 participants