[ 
https://issues.apache.org/jira/browse/SOLR-17280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17844424#comment-17844424
 ] 

Michael Gibney commented on SOLR-17280:
---------------------------------------

If the main question on this issue is about why SolrRangeQuery inserts itself 
in the cache, then that's more of an "under-the-hood" question, arguably 
orthogonal to the recursive update IllegalStateException, which I really do 
think is same issue as SOLR-16707, even if the description on this issue is 
more fully fleshed out.

I don't think we can practically require individual queries to know whether 
they might need to set themselves to async=true. Also, above mentions [PR 
1480|https://github.com/apache/solr/pull/1480], which fixes the test, but not 
the user-facing behavior; but there's also [PR 
1481|https://github.com/apache/solr/pull/1481], which fixes both, by detecting 
recursive invocation (when async==false) at runtime and falling back to 
get-then-put only when it's actually necessary in practice.

Apologies for letting that PR (1481) languish so long. I should update to 
respond to David's review suggestions and just merge it, I think it's the right 
thing to do.

That said, I am in favor of deprecating {{async=false}}. PR 1481 really does 
fix this though (incl. for users -- all configurations), which makes me a bit 
ambivalent on whether to push for such deprecation, because I believe there is 
one case where {{async=false}} is potentially desirable: in cases of very high 
cache turnover with values that are computed very fast, at which point the 
overhead of async bookkeeping can become non-negligible wrt the cost of cache 
consultation overall. None of the default solr caches actually fit this 
description though, afaik, and I am basically already swayed by the argument 
that keeping {{async=false}} around for third-party use cases that _do_ fit 
this description is not worth the extra complexity. (Notably, if somebody has 
such a use case, directly using Caffeine or writing a custom SolrCache wrapper 
around Caffeine would be pretty straightforward).

> SolrRangeQuery can trigger "IllegalStateException: Recursive update" in 
> CaffeineCache / ConcurrentHashMap
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-17280
>                 URL: https://issues.apache.org/jira/browse/SOLR-17280
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Chris M. Hostetter
>            Priority: Major
>
> Sample stacktrace...
> {noformat}
>   2>           => java.lang.IllegalStateException: Recursive update
>   2>    at 
> java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1063)
>   2> java.lang.IllegalStateException: Recursive update
>   2>    at 
> java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1063)
>  ~[?:?]
>   2>    at 
> java.base/java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1541)
>  ~[?:?]
>   2>    at 
> com.github.benmanes.caffeine.cache.BoundedLocalCache.put(BoundedLocalCache.java:2312)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> com.github.benmanes.caffeine.cache.BoundedLocalCache.put(BoundedLocalCache.java:2278)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at org.apache.solr.search.CaffeineCache.put(CaffeineCache.java:277) 
> ~[main/:?]
>   2>    at 
> org.apache.solr.query.SolrRangeQuery$ConstWeight.getSegState(SolrRangeQuery.java:482)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.query.SolrRangeQuery$ConstWeight.scorer(SolrRangeQuery.java:552)
>  ~[main/:?]
>   2>    at org.apache.lucene.search.Weight.scorerSupplier(Weight.java:135) 
> ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.lucene.search.BooleanWeight.requiredBulkScorer(BooleanWeight.java:289)
>  ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.lucene.search.BooleanWeight.booleanScorer(BooleanWeight.java:402) 
> ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.lucene.search.BooleanWeight.bulkScorer(BooleanWeight.java:443) 
> ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:737) 
> ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:720) 
> ~[main/:?]
>   2>    at 
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:552) 
> ~[lucene-core-9.10.0.jar:9.10.0 695c0ac84508438302cd346a812cfa2fdc5a10df - 
> 2024-02-14 16:48:06]
>   2>    at 
> org.apache.solr.search.DocSetUtil.createDocSetGeneric(DocSetUtil.java:154) 
> ~[main/:?]
>   2>    at 
> org.apache.solr.search.DocSetUtil.createDocSet(DocSetUtil.java:141) ~[main/:?]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.getDocSetNC(SolrIndexSearcher.java:1387)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.lambda$getAndCacheDocSet$1(SolrIndexSearcher.java:991)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.search.CaffeineCache.lambda$computeIfAbsent$1(CaffeineCache.java:258)
>  ~[main/:?]
>   2>    at 
> com.github.benmanes.caffeine.cache.LocalCache.lambda$statsAware$2(LocalCache.java:167)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2688)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908)
>  ~[?:?]
>   2>    at 
> com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2686)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2669)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> com.github.benmanes.caffeine.cache.LocalManualCache.get(LocalManualCache.java:62)
>  ~[caffeine-3.1.8.jar:3.1.8]
>   2>    at 
> org.apache.solr.search.CaffeineCache.computeIfAbsent(CaffeineCache.java:253) 
> ~[main/:?]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.getAndCacheDocSet(SolrIndexSearcher.java:991)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.getPositiveDocSet(SolrIndexSearcher.java:946)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.search.SolrIndexSearcher.numDocs(SolrIndexSearcher.java:2367) 
> ~[main/:?]
>   2>    at 
> org.apache.solr.request.SimpleFacets.getFacetQueryCount(SimpleFacets.java:320)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.request.SimpleFacets.getFacetQueryCounts(SimpleFacets.java:302)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.handler.component.FacetComponent.getFacetCounts(FacetComponent.java:331)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:279)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:466)
>  ~[main/:?]
>   2>    at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:238)
>  ~[main/:?]
>   2>    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2886) 
> ~[main/:?]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to