gemmellr commented on a change in pull request #3985:
URL: https://github.com/apache/activemq-artemis/pull/3985#discussion_r826804162
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
##########
@@ -717,15 +717,16 @@ public boolean checkMemory(boolean runOnFailure, final
Runnable runWhenAvailable
runWhenBlocking.run();
}
-
onMemoryFreedRunnables.add(AtomicRunnable.checkAtomic(runWhenAvailable));
+ AtomicRunnable atomicRunWhenAvailable =
AtomicRunnable.checkAtomic(runWhenAvailable);
+ onMemoryFreedRunnables.add(atomicRunWhenAvailable);
// We check again to avoid a race condition where the size can
come down just after the element
// has been added, but the check to execute was done before the
element was added
// NOTE! We do not fix this race by locking the whole thing, doing
this check provides
// MUCH better performance in a highly concurrent environment
if (!pagingManager.isGlobalFull() && (sizeInBytes.get() < maxSize
|| maxSize < 0)) {
// run it now
- runWhenAvailable.run();
+ atomicRunWhenAvailable.run();
Review comment:
Nope just the obvious cases mentioned on the JIRA, spotted when reading
it for some older PR (dont recall which). Theres probably a few different paths
it can happen, but the most basic solution used here hits the general issue.
Took a lot longer to come up with a reliable test to exercise the problem than
to fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]