Apache Solr open-source search software
SOLR-8189: eTag calculation during HTTP Cache Validation uses unsynchronized WeakHashMap causing threads to be stuck in runnable state
Shalin Shekhar Mangar3a4b4310b48c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 602e4fa8b75..8d129a9d99d 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -288,6 +288,9 @@ Bug Fixes* SOLR-7843: DataImportHandler's delta imports leak memory because the delta keys are kept in memoryand not cleared after the process is finished. (Pablo Lozano via shalin)++* SOLR-8189: eTag calculation during HTTP Cache Validation uses unsynchronized WeakHashMap causing+ threads to be stuck in runnable state. (shalin)Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java b/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.javaindex 7785f1aa757..228a169a474 100644--- a/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java+++ b/solr/core/src/java/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java@@ -56,8 +56,7 @@ public final class HttpCacheHeaderUtil {** @see #calcEtag*/- private static Map<SolrCore, EtagCacheVal> etagCoreCache- = new WeakHashMap<>();+ private static Map<SolrCore, EtagCacheVal> etagCoreCache = Collections.synchronizedMap(new WeakHashMap<>());/** @see #etagCoreCache */private static class EtagCacheVal {