[ https://issues.apache.org/jira/browse/SOLR-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated SOLR-647: ------------------------------- Attachment: solr-647.patch My apologies to all for cluttering the issue. New simplified version based on Yonik's example for trunk 685913 (post solr-695 commit), dont let the patch size fool you: CoreContainer.getCore() & CoreContainer.getAdminCore() now return an incref-ed ("opened") core; core.close() must be called when these 2 have been used. SolrCore.Reference is gone. SolrCore.open() & SolrCore.close() method are kept because we can retrieve cores in 3 "close-unprotected" ways: 1 - a call to CoreDescriptor.getCore(), descriptors that can be retrieved through CoreContainer.getCoreDescriptors()) 2 - a list of close-unprotected cores through CoreContainer.getCores(). 3 - SolrCore.getCore() - which is deprecated The first 2 can be used in a user-defined filter/servlet after the SolrDispatchFilter falls through the filter-chain, the CoreContainer being set as an attribute of the request ("org.apache.solr.CoreContainer"). Because of this, we are not always synchronized by the CoreContainer#cores when we incref/decref. We can thus try to open() a core which is closed and cant use a simple refCount.incrementAndGet(). Thus the refCount.get()/refCount.compareAndSet() pattern in both open & close. The TestHarness is modified to always create a CoreContainer that contains the "unnamed" core so testCoreMT uses CoreContainer.getCore(""). Also touched some tests that were using SolrCore.getCore() when they can use the TestHarness core. > Do SolrCore.close() in a refcounted way > --------------------------------------- > > Key: SOLR-647 > URL: https://issues.apache.org/jira/browse/SOLR-647 > Project: Solr > Issue Type: Bug > Affects Versions: 1.3 > Reporter: Noble Paul > Assignee: Grant Ingersoll > Fix For: 1.3 > > Attachments: refcount_example.patch, solr-647.patch, solr-647.patch, > solr-647.patch, solr-647.patch, solr-647.patch, solr-647.patch, > SOLR-647.patch, SOLR-647.patch > > > The method _SolrCore.close()_ directly closes the core . It can cause > Exceptions for in-flight requests. The _close()_ method should just do a > decrement on refcount and the actual close must happen when the last request > being processed by that core instance is completed -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.