Skip to content

Commit 08fa00a

Browse files
committed
Fix possible assertion failure in IndicesQueryCache.close (elastic#38714)
The assertion that the stats2 map is empty in IndicesQueryCache.close has been observed to fail very occasionally in internal cluster tests. The likely cause is a cross-thread visibility problem for a count variable. This change makes that count volatile. Relates elastic#37117
1 parent 9e95821 commit 08fa00a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/indices/IndicesQueryCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ QueryCacheStats toQueryCacheStats() {
206206
}
207207

208208
private static class StatsAndCount {
209-
int count;
209+
volatile int count;
210210
final Stats stats;
211211

212212
StatsAndCount(Stats stats) {

0 commit comments

Comments
 (0)