You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adam Ahmed (JIRA)" <ji...@apache.org> on 2011/06/08 07:38:58 UTC

[jira] [Commented] (LUCENE-91) IndexWriter ctor does not release lock on exception

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

Adam Ahmed commented on LUCENE-91:
----------------------------------

Please note that this also happens when Lock.obtain times out.  As far as I can tell, the only way to avoid that possibility is to LOCK_OBTAIN_WAIT_FOREVER, and "forever" generally sounds like a bad idea.  I would say that is a bug, and more clearly so than exceptions due to the index not existing.

> IndexWriter ctor does not release lock on exception
> ---------------------------------------------------
>
>                 Key: LUCENE-91
>                 URL: https://issues.apache.org/jira/browse/LUCENE-91
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 1.2
>         Environment: Operating System: All
> Platform: All
>            Reporter: Alex Staubo
>            Assignee: Lucene Developers
>
> If IndexWriter construction fails with an exception, the write.lock lock is not
> released.
> For example, this happens if one tries to open an IndexWriter on an FSDirectory
> which does not contain an Lucene index. FileNotFoundException will be thrown by
> org.apache.lucene.store.FSInputStream, after which the write lock will remain in
> the directory, and nobody can open the index.
> I have been using this pattern -- doing IndexWriter(..., false), catching
> FileNotFoundException and doing IndexWriter(..., true) -- in my code to
> initialize the index on demand, because the app never know if the index already
> exists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

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