This is an automated email from the ASF dual-hosted git repository.
krathbun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 467183d38c Fixes unsafe iteration over a collection (#5461)
467183d38c is described below
commit 467183d38c9aa3d5bf22057f798dfa15ef8e1876
Author: Kevin Rathbun <[email protected]>
AuthorDate: Thu Apr 10 09:42:15 2025 -0400
Fixes unsafe iteration over a collection (#5461)
AbstractFateStore's `deferred` collection was being iterated over
without locking
---
.../java/org/apache/accumulo/core/fate/AbstractFateStore.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java
b/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java
index e917246182..45f93250e4 100644
--- a/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java
+++ b/core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java
@@ -202,10 +202,12 @@ public abstract class AbstractFateStore<T> implements
FateStore<T> {
if (seen.get() == 0) {
if (beforeCount == unreservedRunnableCount.getCount()) {
long waitTime = 5000;
- if (!deferred.isEmpty()) {
- waitTime = deferred.values().stream()
- .mapToLong(countDownTimer ->
countDownTimer.timeLeft(TimeUnit.MILLISECONDS)).min()
- .getAsLong();
+ synchronized (deferred) {
+ if (!deferred.isEmpty()) {
+ waitTime = deferred.values().stream()
+ .mapToLong(countDownTimer ->
countDownTimer.timeLeft(TimeUnit.MILLISECONDS)).min()
+ .getAsLong();
+ }
}
if (waitTime > 0) {