Repository navigation
[#868] Release the import/export context before notifying the initialize task - #869
Merged
vharseko merged 1 commit intoAug 19, 2026
Conversation
…otifying the initialize task ReplicationDomain terminated a total update by notifying the initialize task first and releasing the import/export context afterwards. Anything reacting to that completion - the task thread of a real InitializeTask, or ReplicationDomainTest.errorMsgFromSameMillisecondTerminatesPendingInitialize woken up by the listener thread - could still observe ieRunning() as true and get its own total update rejected as a simultaneous import/export. Release the context first and notify the task afterwards, from a single completeInitializeTask() helper shared by the three termination paths: the ErrorMsg answering a pending initialization, the stalled-request watchdog and the end of an import from a remote replica. In that last path the notification also moves into the finally block that releases the context: it was previously skipped when notifying the exporter failed, leaving the task waiting forever. Fixes OpenIdentityPlatform#868
maximthomas
approved these changes
Aug 19, 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 #868.
ReplicationDomainterminated a total update by notifying the initialize task first and releasing the import/export context afterwards. Between the two,ieRunning()still reportstrue, so anything reacting to the completion — the task thread of a realInitializeTask, orReplicationDomainTest.errorMsgFromSameMillisecondTerminatesPendingInitializewoken up on the listener thread's notification — can see its own total update rejected as a simultaneous import/export.That window is what made the test fail in CI (run 32124729058, ubuntu-latest/26); the other 8 matrix jobs of the same run were green.
What changed
All three import-termination paths now go through one helper that releases the context before notifying the task:
processErrorMsg()— theErrorMsganswering a pending initialization (the path that flaked).abortStalledInitializeFromRemote()— the stalled-request watchdog from [#861] Fail fast when a total update request gets no answer #864.initialize()— the end of an import from a remote replica.The reordering is safe:
ieCtxstays reachable through the local reference andgetException()reads that object, not theAtomicReference.In
initialize()the notification also moves from thetryinto thefinallythat releases the context. It used to sit afterbroker.publish(errorMsg), so a failure while notifying the exporter skippedupdateTaskCompletionState()altogether and left the task waiting forever — the failure mode fixed in #861/#864. The "update the task must be the last thing" requirement refers tobroker.reStart(false), which runs before this block, so it still holds. As a side effect the task is now also notified when the import fails beforeinitFromTaskis assigned (e.g.initializeCounters()throwing), where it previously got no notification at all. Remote-initiated imports carry no local task and are unaffected.Tests
No test change:
releaseIEContext()is a volatile write and the task notification gives happens-before, so the existing assertion becomes deterministic instead of racy. Relaxing it into a poll would have hidden the defect.mvn -pl opendj-server-legacy -Pprecommit verify -Dit.test=ReplicationDomainTest— 12/12 green locally.