ben-manes commented on PR #1118: URL: https://github.com/apache/solr/pull/1118#issuecomment-1295272732
Thanks to @DennisBerger1984's help, we met to step through the debug session of the cache in this invalid state. Dennis captured this [jstack output](https://github.com/apache/solr/files/9890391/stack.txt). We confirmed the findings that the filterCache is stuck in an infinite loop due to retrieving a dead entry. When pairing on a code walkthrough, we came up with a scenario that could explain this problem and would require some Solr experts to advise us on. In short, is the cache key stable in filter cache? This is a `org.apache.lucene.search.Query` object and appears to be mutable. Can a query be modified after it was inserted into the cache? If so, then the cache might fail to remove it during eviction, eagerly mark it as dead, and rediscover it later by a lookup. As modifiable keys are violations to the Map contract it is not detected or handled. During eviction, Caffeine uses a `computeIfPresent` to remove the victim entry. If the entry was not found in the map, then we assume it was due to an explicit, concurrent removal. This allows the cache to eagerly decrement the current size and avoid unnecessary additional evictions to be within bounds. If a concurrent removal then a `RemovalTask` is queued and will no-op when run. However if the key's hash/equals were modified then eviction would instead leave a dead entry in the map, and a subsequent lookup might discover it by a map lookup. @DennisBerger1984 suggested that the filter cache could use an immutable cache key object. Given the subtypes, Is there an easy way to do this? Would using `toString()` result in a key with the right uniqueness properties? If we can apply this change then Dennis will retest and we'll see if our hypothesis holds. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org