You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky testAsynchronousBatch: pre-handshake operation response is dropped, executeBatch hangs until "Operation finished on remote server with unknown result" #107
AsyncRemoteSecureConnectorInfoManagerTest.testAsynchronousBatch intermittently fails in CI (windows-latest, Java 26) after exactly 540 s:
org.identityconnectors.framework.common.exceptions.ConnectorException: Operation finished on remote server with unknown result
at org.forgerock.openicf.framework.remote.rpc.RemoteOperationRequest.check(RemoteOperationRequest.java:70)
at org.forgerock.openicf.framework.remote.rpc.WebSocketConnectionGroup.checkIsActive(WebSocketConnectionGroup.java:353)
at org.forgerock.openicf.framework.client.ConnectionManager$2.run(ConnectionManager.java:141)
This still reproduces after #105, which fixed a different race (CompletionListener.start() double-start).
Root cause
The job log shows the full chain:
OpenICFServerAdapter.onMessage dispatches every WebSocket message to a cached thread pool (ConnectorFramework.messageExecutor), so two messages delivered in order on the same socket can be processed out of order. On a freshly opened socket the server's batch-token operation response overtook the handshake response:
07:27:28.990 Client received response('2') before handshake via socket:916,147,150
07:27:29.019 Client accept Handshake (C6E44631...:916,147,150)
The pre-handshake branch of handleResponseMessagesilently discards the response (only bounces an error to the peer), so the batch token was lost.
All task results and the "complete" message arrived on other sockets, so BatchApiOpImpl$InternalRequest.CompletionListener started waiting, timed out 5 s later with returnToken == null:
07:27:29.078 CompletionListener waiting for final result to complete.
07:27:34.118 Batch CompletionListener timed out. Unable to return batch token.
and exited without completing the promise, leaving the caller blocked forever in promise.getOrThrowUninterruptibly() inside executeBatch().
The client's connection group checker (runs at 1 min, then every 4 min) collected 3 inconsistent() strikes from the peer's ControlRequests (the server had long finished the request) and failed the operation at the 9-minute mark — hence exactly 540 s elapsed.
Proposed fix
OpenICFServerAdapter.processMessage: before dispatching a non-handshake message on a socket that is not yet handhooked, briefly wait for the concurrently-processing handshake to complete instead of discarding the message (falls back to the current behavior if no handshake arrives).
BatchApiOpImpl.CompletionListener: when the wait times out with no batch token, fail the promise with a ConnectorException instead of returning silently, so a lost token surfaces as an error in seconds instead of a 9-minute hang.
Activity