From 3a4b4310b48c8c79ad686a535ab8dc849102ada5 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Fri, 23 Oct 2015 14:03:49 +0000 Subject: [PATCH] SOLR-8189: eTag calculation during HTTP Cache Validation uses unsynchronized WeakHashMap causing threads to be stuck in runnable state git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1710218 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 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 memory and 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.java index 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 etagCoreCache - = new WeakHashMap<>(); + private static Map etagCoreCache = Collections.synchronizedMap(new WeakHashMap<>()); /** @see #etagCoreCache */ private static class EtagCacheVal {