Gautam Worah created LUCENE-10077:
-------------------------------------

             Summary: Closing the DirTaxonomyReader while another thread access 
the cache can throw NPE
                 Key: LUCENE-10077
                 URL: https://issues.apache.org/jira/browse/LUCENE-10077
             Project: Lucene - Core
          Issue Type: Improvement
          Components: modules/facet
    Affects Versions: main (9.0)
            Reporter: Gautam Worah


When we close a {{DirectoryTaxonomyReader}} in {{doClose}}, we set the 
{{categoryCache}} to null. But if a thread is next after this {{doClose}} call, 
it will still try to acquire a lock and {{synchronize}} on it. This will result 
in an NPE.

This works well today, because we operate on the assumption that the user will 
always call {{doClose}} after all threads have completed. 
 One suggestion by [~mikemccand] in this 
[PR|https://github.com/apache/lucene/pull/179#discussion_r697880516] was to 
make categoryCache final and throw an AlreadyClosedException.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to