Skip to content

Commit 3b1abd7

Browse files
authored
Fix possible assertion failure in IndicesQueryCache.close (#38733)
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 #37117 Backport of #38714
1 parent 18f194f commit 3b1abd7

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)