Skip to content

[#4659] Wrap LockingRepository#doLoadOrCreate try-catch in outer try-catch to ensure locks are released#4679

Merged
smcvb merged 2 commits into
axon-4.13.xfrom
bug/4659
Jun 23, 2026
Merged

[#4659] Wrap LockingRepository#doLoadOrCreate try-catch in outer try-catch to ensure locks are released#4679
smcvb merged 2 commits into
axon-4.13.xfrom
bug/4659

Conversation

@smcvb

@smcvb smcvb commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This pull request moves the catch-all catch(Exception) to be an outer try-catch instead of being part of the single try-catch.
In doing so, we ascertain that the exception rethrown when isExactAggregateNotFound(Class<? extends AggregateNotFoundException>) is false is caught, resulting in the lock to be released.
If we do not, we can accidentally keep a lock for an aggregate that's been marked deleted, but is hit with a quick subsequent create-if-missing invocation.

In doing the above, this PR resolves #4659.

Wrap try-catch in another try-catch to ensure locks are released in case
 the aggregate was deleted and at the same time another thread tried to
 create-if-missing the deleted aggregate. Without the outer try-catch,
 the rethrowing of the deleted exception does not result in a lock
 releasing. By moving the catch-all catch that released the lock to an
 outer try-catch, we are certain the lock is also released for this
 scenario.

#4659
@smcvb smcvb added this to the Release 4.13.2 milestone Jun 22, 2026
@smcvb smcvb self-assigned this Jun 22, 2026
@smcvb smcvb added Type: Bug Use to signal issues that describe a bug within the system. Priority 2: Should High priority. Ideally, these issues are part of the release they’re assigned to. labels Jun 22, 2026
@smcvb smcvb requested review from a team, jangalinski, laura-devriendt-lemon and zambrovski and removed request for a team June 22, 2026 13:20

@hatzlj hatzlj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a cosmetic finding in the LockingRepositoryTest, otherwise LGTM

Minor cosmetic test change

#4659
@smcvb smcvb enabled auto-merge June 23, 2026 10:11
@smcvb smcvb disabled auto-merge June 23, 2026 10:27
@smcvb smcvb merged commit c28a153 into axon-4.13.x Jun 23, 2026
4 of 5 checks passed
@smcvb smcvb deleted the bug/4659 branch June 23, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority 2: Should High priority. Ideally, these issues are part of the release they’re assigned to. Type: Bug Use to signal issues that describe a bug within the system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants