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

Thomas Mueller commented on OAK-8898:
-------------------------------------

[~mkataria] I created a branch here: 
[https://github.com/oak-indexing/jackrabbit-oak/tree/OAK-8898]

This allows to reproduce the issue (it is based on your test case).

I also found the root cause, and a possible solution (see 
LucenePropertyIndex.OLD_FACET_PROVIDER). The problem seems to be that the 
reader is used after it is closed, by leaking the reference to the searcher to 
the LuceneFacetProvider in loadDocs(). I created a DelayedLuceneFacetProvider 
that opens acquires and releases the searcher when needed (acquireIndexNode, 
release in finally).

It would be good if the test can reproduce the issue even without the delays; 
we can discuss this. 

> On querying, IndexReader failed with AlreadyClosedException
> -----------------------------------------------------------
>
>                 Key: OAK-8898
>                 URL: https://issues.apache.org/jira/browse/OAK-8898
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Mohit Kataria
>            Priority: Major
>
>  This is an intermittent issue, where on querying the code throws 
> AlreadyClosedException.
>  
> {code:java}
> Caused by: org.apache.lucene.store.AlreadyClosedException: this IndexReader 
> is closed
>       at org.apache.lucene.index.IndexReader.ensureOpen(IndexReader.java:262) 
> [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.lucene.index.BaseCompositeReader.document(BaseCompositeReader.java:108)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at org.apache.lucene.index.IndexReader.document(IndexReader.java:446) 
> [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.util.StatisticalSortedSetDocValuesFacetCounts.getAccessibleSampleCount(StatisticalSortedSetDocValuesFacetCounts.java:169)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.util.StatisticalSortedSetDocValuesFacetCounts.getTopChildren0(StatisticalSortedSetDocValuesFacetCounts.java:104)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.util.StatisticalSortedSetDocValuesFacetCounts.getTopChildren(StatisticalSortedSetDocValuesFacetCounts.java:70)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.lucene.facet.MultiFacets.getTopChildren(MultiFacets.java:52) 
> [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex$LuceneFacetProvider.getFacets(LucenePropertyIndex.java:1547)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextResultRow.getFacets(FulltextIndex.java:353)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       at 
> org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextPathCursor$2.getValue(FulltextIndex.java:472)
>  [org.apache.jackrabbit.oak-lucene:1.10.2]
>       ... 237 common frames omitted
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to