lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-818) IndexWriter should detect when it's used after being closed
Date Tue, 27 Feb 2007 20:20:05 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476360
] 

Michael McCandless commented on LUCENE-818:
-------------------------------------------

I see, so IndexInput indeed does not track isClosed.  It's not easy to
fix that since IndexInput is public and non-final?

Though I'm actually less concerned about this one because it's very
"internal" to Lucene.

I'm more concerned about the public paths (IndexWriter, IndexReader).
Users seem to accidentally close these classes fairly often.  I think
IndexSearcher is OK because on close it at worst closes the underlying
IndexReader, and then any call to that IndexReader will catch that
it's closed.

Oh, I see: this public path will indeed access IndexInput after it's
been closed:

  Open reader
  Get a doc w/ lazy field(s)
  Close reader
  Try to get the lazy field's value

That last step will clone the cloneableFieldsStream after it had been
closed.  Hmmm.  Though I think we could just fix this path in
FieldsReader by having it record when it's closed & throw an
AlreadyClosedException if the LazyField class is used after that?
That seems like the simplest fix.


> IndexWriter should detect when it's used after being closed
> -----------------------------------------------------------
>
>                 Key: LUCENE-818
>                 URL: https://issues.apache.org/jira/browse/LUCENE-818
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.1
>            Reporter: Michael McCandless
>         Assigned To: Michael McCandless
>            Priority: Minor
>
> Spinoff from this thread on java-user:
>     http://www.gossamer-threads.com/lists/lucene/java-user/45986
> If you call addDocument on IndexWriter after it's closed you'll hit a
> hard-to-explain NullPointerException (because the RAMDirectory was
> closed).  Before 2.1, apparently you won't hit any exception and the
> IndexWrite will keep running but will have released it's write lock (I
> think).
> I plan to fix IndexWriter methods to throw an IllegalStateException if
> it has been closed.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message