You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "John Wang (JIRA)" <ji...@apache.org> on 2010/03/05 06:55:27 UTC

[jira] Created: (SOLR-1808) When IndexReader.reopen is called, old reader is not properly closed

When IndexReader.reopen is called, old reader is not properly closed
--------------------------------------------------------------------

                 Key: SOLR-1808
                 URL: https://issues.apache.org/jira/browse/SOLR-1808
             Project: Solr
          Issue Type: Bug
          Components: search
    Affects Versions: 1.4
            Reporter: John Wang


According to Lucene documentation:
"If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable."

In SolrCore.java:

if (newestSearcher != null && solrConfig.reopenReaders
          && indexDirFile.equals(newIndexDirFile)) {
        IndexReader currentReader = newestSearcher.get().getReader();
        IndexReader newReader = currentReader.reopen();

        if (newReader == currentReader) {
          currentReader.incRef();
        }

        tmp = new SolrIndexSearcher(this, schema, "main", newReader, true, true);
      }

When currentReader!=newReader, currentReader seems to be leaking.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1808) When IndexReader.reopen is called, old reader is not properly closed

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843363#action_12843363 ] 

Yonik Seeley commented on SOLR-1808:
------------------------------------

bq. Solr is maintaining a heavy weight Searcher instance

Well... IndexSearcher isn't particularly heavyweight, but Solr's implementation is (due to historical reasons mostly).
No one is calling it optimal - we need to move more stuff to per-segment caching over time.

> When IndexReader.reopen is called, old reader is not properly closed
> --------------------------------------------------------------------
>
>                 Key: SOLR-1808
>                 URL: https://issues.apache.org/jira/browse/SOLR-1808
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> According to Lucene documentation:
> "If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable."
> In SolrCore.java:
> if (newestSearcher != null && solrConfig.reopenReaders
>           && indexDirFile.equals(newIndexDirFile)) {
>         IndexReader currentReader = newestSearcher.get().getReader();
>         IndexReader newReader = currentReader.reopen();
>         if (newReader == currentReader) {
>           currentReader.incRef();
>         }
>         tmp = new SolrIndexSearcher(this, schema, "main", newReader, true, true);
>       }
> When currentReader!=newReader, currentReader seems to be leaking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1808) When IndexReader.reopen is called, old reader is not properly closed

Posted by "John Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843361#action_12843361 ] 

John Wang commented on SOLR-1808:
---------------------------------

Thanks Mark and Chris. I meant to close this bug, but kept forgetting it. Thanks for explaining.

On the same node, Solr is maintaining a heavy weight Searcher instance, but the search related information is stored with reader. This is especially important with lucene 2.9 where segmented readers are more exposed. Do you guys still think having heavy SolrIndexSearcher instances is a good thing?

Anyway, no problem with closing this issue.

> When IndexReader.reopen is called, old reader is not properly closed
> --------------------------------------------------------------------
>
>                 Key: SOLR-1808
>                 URL: https://issues.apache.org/jira/browse/SOLR-1808
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> According to Lucene documentation:
> "If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable."
> In SolrCore.java:
> if (newestSearcher != null && solrConfig.reopenReaders
>           && indexDirFile.equals(newIndexDirFile)) {
>         IndexReader currentReader = newestSearcher.get().getReader();
>         IndexReader newReader = currentReader.reopen();
>         if (newReader == currentReader) {
>           currentReader.incRef();
>         }
>         tmp = new SolrIndexSearcher(this, schema, "main", newReader, true, true);
>       }
> When currentReader!=newReader, currentReader seems to be leaking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-1808) When IndexReader.reopen is called, old reader is not properly closed

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man resolved SOLR-1808.
----------------------------

    Resolution: Not A Problem

As mark said: IndexReaders are refcounted (regardless of whether they come from open or reopen) so that they aren't closed until they are no logner in use.

I'm not seeing any evidence of a bug here, pelase reopen if you can point to a concrete example of where an IndexReader is being leaked.

> When IndexReader.reopen is called, old reader is not properly closed
> --------------------------------------------------------------------
>
>                 Key: SOLR-1808
>                 URL: https://issues.apache.org/jira/browse/SOLR-1808
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> According to Lucene documentation:
> "If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable."
> In SolrCore.java:
> if (newestSearcher != null && solrConfig.reopenReaders
>           && indexDirFile.equals(newIndexDirFile)) {
>         IndexReader currentReader = newestSearcher.get().getReader();
>         IndexReader newReader = currentReader.reopen();
>         if (newReader == currentReader) {
>           currentReader.incRef();
>         }
>         tmp = new SolrIndexSearcher(this, schema, "main", newReader, true, true);
>       }
> When currentReader!=newReader, currentReader seems to be leaking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1808) When IndexReader.reopen is called, old reader is not properly closed

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841844#action_12841844 ] 

Mark Miller commented on SOLR-1808:
-----------------------------------

Right - thats how its supposed to work - we don't close the old instance because it can still be serving requests on a previous SolrIndexSearcher - it will be closed when that Searcher is closed.

> When IndexReader.reopen is called, old reader is not properly closed
> --------------------------------------------------------------------
>
>                 Key: SOLR-1808
>                 URL: https://issues.apache.org/jira/browse/SOLR-1808
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> According to Lucene documentation:
> "If the index has not changed since this instance was (re)opened, then this call is a NOOP and returns this instance. Otherwise, a new instance is returned. The old instance is not closed and remains usable."
> In SolrCore.java:
> if (newestSearcher != null && solrConfig.reopenReaders
>           && indexDirFile.equals(newIndexDirFile)) {
>         IndexReader currentReader = newestSearcher.get().getReader();
>         IndexReader newReader = currentReader.reopen();
>         if (newReader == currentReader) {
>           currentReader.incRef();
>         }
>         tmp = new SolrIndexSearcher(this, schema, "main", newReader, true, true);
>       }
> When currentReader!=newReader, currentReader seems to be leaking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.