Skip to content

[#690] Fix finalizeWorkQueue never cancelling queued operations - #691

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:features/workqueue-shutdown-drain
Jul 9, 2026
Merged

[#690] Fix finalizeWorkQueue never cancelling queued operations#691
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:features/workqueue-shutdown-drain

Conversation

@vharseko

Copy link
Copy Markdown
Member

Problem

TraditionalWorkQueue.finalizeWorkQueue() is supposed to drain the pending operation queue at shutdown and send a "server shutting down" cancel response to every queued operation. Instead it calls:

ArrayList<Operation> pendingOperations = newArrayList<>();
opQueue.removeAll(pendingOperations);

Collection.removeAll(c) removes from the queue the elements contained in the argument — and the argument is a freshly created empty list, so nothing is removed and the list stays empty. removeAll never populates its argument, so the abort loop below is dead code: operations still queued at shutdown are silently dropped and their clients never receive a response (they wait until the connection is torn down).

The bug dates back to the original OpenDS implementation — the same pattern is present in the pre-OpenDJ-3 TraditionalWorkQueue — and went unnoticed because the queue is usually empty at shutdown.

Fix

Use opQueue.drainTo(pendingOperations), which moves all queued operations into the list so that each one gets aborted with the shutdown CancelRequest, as the surrounding code and comments intend.

Verification

TraditionalWorkQueueTestCase: 6/6 pass.

Fixes#690

TraditionalWorkQueue.finalizeWorkQueue() intended to drain the pending
operation queue and send a "server shutting down" cancel response to
every queued operation, but it called
opQueue.removeAll(pendingOperations) with a freshly created empty
list, which removes nothing and leaves the list empty, so the abort
loop never ran. Operations still queued at shutdown were silently
dropped and their clients never received a response.
Use drainTo() as intended. The bug dates back to the original OpenDS
implementation.
FixesOpenIdentityPlatform#690
@vharsekovharseko changed the title Fix finalizeWorkQueue never cancelling queued operations[#690] Fix finalizeWorkQueue never cancelling queued operationsJul 6, 2026
@vharseko
vharseko merged commit c27ff32 into OpenIdentityPlatform:masterJul 9, 2026
17 checks passed
@vharseko
vharseko deleted the features/workqueue-shutdown-drain branch July 9, 2026 09:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TraditionalWorkQueue.finalizeWorkQueue never cancels queued operations: removeAll(empty list) is a no-op

2 participants

@vharseko@maximthomas