[ https://issues.apache.org/jira/browse/SOLR-13898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16973242#comment-16973242 ]
Andrzej Bialecki commented on SOLR-13898: ----------------------------------------- Hmm, I got an interesting test failure caused by the changes in {{SolrIndexSearcher}}: {code} [junit4] 2> 1816820 ERROR (qtp46186557-36639) [n:127.0.0.1:60103_solr c:org.apache.solr.search.facet.TestCloudJSONFacetJoinDomain_collection s:shard1 r:core_node2 x:org.apache.solr.search.facet.TestCloudJSONFacetJoinDomain_collection_shard1_replica_n1 ] o.a.s.s.HttpSolrCall null:java.lang.IllegalStateException: Recursive update [junit4] 2> at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1063) [junit4] 2> at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) [junit4] 2> at org.apache.solr.util.ConcurrentLRUCache.putCacheEntry(ConcurrentLRUCache.java:264) [junit4] 2> at org.apache.solr.util.ConcurrentLRUCache.put(ConcurrentLRUCache.java:254) [junit4] 2> at org.apache.solr.search.FastLRUCache.put(FastLRUCache.java:240) [junit4] 2> at org.apache.solr.search.SolrIndexSearcher.getDocSet(SolrIndexSearcher.java:1198) [junit4] 2> at org.apache.solr.search.JoinQuery$JoinQueryWeight.getDocSetEnumerate(JoinQParserPlugin.java:442) [junit4] 2> at org.apache.solr.search.JoinQuery$JoinQueryWeight.getDocSet(JoinQParserPlugin.java:324) [junit4] 2> at org.apache.solr.search.JoinQuery$JoinQueryWeight.scorer(JoinQParserPlugin.java:253) [junit4] 2> at org.apache.lucene.search.Weight.bulkScorer(Weight.java:168) [junit4] 2> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:741) [junit4] 2> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:516) [junit4] 2> at org.apache.solr.search.DocSetUtil.createDocSetGeneric(DocSetUtil.java:151) [junit4] 2> at org.apache.solr.search.DocSetUtil.createDocSet(DocSetUtil.java:140) [junit4] 2> at org.apache.solr.search.SolrIndexSearcher.getDocSetNC(SolrIndexSearcher.java:1206) [junit4] 2> at org.apache.solr.search.SolrIndexSearcher.lambda$getDocSet$1(SolrIndexSearcher.java:812) [junit4] 2> at org.apache.solr.util.ConcurrentLRUCache.lambda$computeIfAbsent$1(ConcurrentLRUCache.java:223) [junit4] 2> at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) [junit4] 2> at org.apache.solr.util.ConcurrentLRUCache.computeIfAbsent(ConcurrentLRUCache.java:222) [junit4] 2> at org.apache.solr.search.FastLRUCache.computeIfAbsent(FastLRUCache.java:255) [junit4] 2> at org.apache.solr.search.SolrIndexSearcher.getDocSet(SolrIndexSearcher.java:810) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.handleJoinField(FacetProcessor.java:244) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.handleDomainChanges(FacetProcessor.java:167) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.process(FacetProcessor.java:69) [junit4] 2> at org.apache.solr.search.facet.FacetFieldProcessorByArray.process(FacetFieldProcessorByArray.java:61) [junit4] 2> at org.apache.solr.search.facet.FacetRequest.process(FacetRequest.java:416) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.processSubs(FacetProcessor.java:475) [junit4] 2> at org.apache.solr.search.facet.FacetFieldProcessor.fillBucketFromSlot(FacetFieldProcessor.java:545) [junit4] 2> at org.apache.solr.search.facet.FacetFieldProcessor.findTopSlots(FacetFieldProcessor.java:446) [junit4] 2> at org.apache.solr.search.facet.FacetFieldProcessorByArray.calcFacets(FacetFieldProcessorByArray.java:114) [junit4] 2> at org.apache.solr.search.facet.FacetFieldProcessorByArray.process(FacetFieldProcessorByArray.java:62) [junit4] 2> at org.apache.solr.search.facet.FacetRequest.process(FacetRequest.java:416) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.processSubs(FacetProcessor.java:475) [junit4] 2> at org.apache.solr.search.facet.FacetProcessor.fillBucket(FacetProcessor.java:432) [junit4] 2> at org.apache.solr.search.facet.FacetQueryProcessor.process(FacetQuery.java:64) [junit4] 2> at org.apache.solr.search.facet.FacetRequest.process(FacetRequest.java:416) [junit4] 2> at org.apache.solr.search.facet.FacetModule.process(FacetModule.java:147) [junit4] 2> at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:328) [junit4] 2> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:197) {code} I don't see any easy way out of this... I'll revert the changes in {{SolrIndexSearcher}}, let's make this a separate battle. > Non-atomic use of SolrCache get / put > ------------------------------------- > > Key: SOLR-13898 > URL: https://issues.apache.org/jira/browse/SOLR-13898 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Affects Versions: 8.3 > Reporter: Andrzej Bialecki > Assignee: Andrzej Bialecki > Priority: Major > Fix For: 8.4 > > Attachments: SOLR-13898.patch, SOLR-13898.patch, SOLR-13898.patch > > > As pointed out by [~ben.manes] in SOLR-13817 Solr code base in many key > places uses a similar pattern of non-atomic get / put calls to SolrCache-s. > In multi-threaded environment this leads to cache misses and additional > unnecessary computations when competing threads both discover a missing > value, non-atomically compute it and update the cache. > Some of these places are known performance bottlenecks where efficient > caching is especially important, such as {{SolrIndexSearcher}}, > {{SolrDocumentFetcher}}, {{UninvertedField}} and join queries . > I propose to add {{SolrCache.computeIfAbsent(key, mappingFunction)}} that > will atomically retrieve existing values or compute and update the cache. > This will require also changing how the {{SolrCache.get(...)}} is used in > many components. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org