You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mukul Ranjan <mr...@egain.com> on 2016/06/16 10:19:12 UTC

LockFactory issue observed in lucene while getting instance of indexWriter

Hi,

I'm observing below exception while getting instance of indexWriter-

java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName" lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746 still has pending deleted files; cannot initialize IndexWriter

Is it related to the default used NativeFSLockFactory. Should I use simpleFSLockFactory to avoid this type of issue. Please suggest as I'm getting the above exception in my application.

Thanks,
Mukul
Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and LinkedIn<https://www.linkedin.com/company/egain-corporation>

Re: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Ian Lea <ia...@gmail.com>.
Sounds to me like it's related to the index not having been closed properly
or still being updated or something.  I'd worry about that.

--
Ian.


On Thu, Jun 16, 2016 at 11:19 AM, Mukul Ranjan <mr...@egain.com> wrote:

> Hi,
>
> I'm observing below exception while getting instance of indexWriter-
>
> java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName"
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746 still
> has pending deleted files; cannot initialize IndexWriter
>
> Is it related to the default used NativeFSLockFactory. Should I use
> simpleFSLockFactory to avoid this type of issue. Please suggest as I'm
> getting the above exception in my application.
>
> Thanks,
> Mukul
> Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and
> LinkedIn<https://www.linkedin.com/company/egain-corporation>
>

RE: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Mukul Ranjan <mr...@egain.com>.
Hi Mike,

Yes, we are getting indexReader instance from the active Directory. We are using MultiReader to obtain instance of indexSearcher.

Thanks,
Mukul

From: Michael McCandless [mailto:lucene@mikemccandless.com]
Sent: Friday, June 17, 2016 12:56 AM
To: Mukul Ranjan <mr...@egain.com>
Cc: Lucene Users <ja...@lucene.apache.org>
Subject: Re: LockFactory issue observed in lucene while getting instance of indexWriter

But do you open any near-real-time readers from this writer?

Mike McCandless

http://blog.mikemccandless.com

On Thu, Jun 16, 2016 at 1:01 PM, Mukul Ranjan <mr...@egain.com>> wrote:
Hi Michael,

Thanks for your reply.
I’m running it on windows. I have checked my code, I’m closing IndexWriter after adding document to it.
We are not getting this issue always but it’s frequency is high in our application. Can you please provide your suggestion?

Thanks,
Mukul

From: Michael McCandless [mailto:lucene@mikemccandless.com<ma...@mikemccandless.com>]
Sent: Thursday, June 16, 2016 10:22 PM
To: Lucene Users <ja...@lucene.apache.org>>; Mukul Ranjan <mr...@egain.com>>
Subject: Re: LockFactory issue observed in lucene while getting instance of indexWriter

Are you running on Windows?

This is not a LockFactory issue ... it's likely caused because you closed IndexWriter, and then opened a new one, before closing NRT readers you had opened from the first writer?

Mike McCandless

http://blog.mikemccandless.com

On Thu, Jun 16, 2016 at 6:19 AM, Mukul Ranjan <mr...@egain.com>> wrote:
Hi,

I'm observing below exception while getting instance of indexWriter-

java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName" lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746<ma...@1ec79746> still has pending deleted files; cannot initialize IndexWriter

Is it related to the default used NativeFSLockFactory. Should I use simpleFSLockFactory to avoid this type of issue. Please suggest as I'm getting the above exception in my application.

Thanks,
Mukul
Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and LinkedIn<https://www.linkedin.com/company/egain-corporation>



Re: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Michael McCandless <lu...@mikemccandless.com>.
That looks like correct usage of MultiSearcher ... just be sure the
"release" happens in a finally clause.

But have a look at my prior email ... it's best to keep a single
IndexWriter open per index, and pass that writer when you create your
SearcherManagers.

Mike McCandless

Mike McCandless

http://blog.mikemccandless.com

On Wed, Jun 29, 2016 at 8:10 AM, Mukul Ranjan <mr...@egain.com> wrote:

> Hi Mike,
>
>
>
> I observed the issue from some time and observed that there may issue with
> the MultiSearcher that I’m using for searcher over multiple index folders.
>
>
>
> I’m getting the searcher instance by using below code –  (Note: Searchable
> is the object of searchManager)
>
>
>
> IndexReader[] readers = new IndexReader[searchables.length];
>
> IndexSearcher[] tempSearchers = new IndexSearcher[searchables.length];
>
> for (int i = 0; i < searchables.length; i++)
>
> {
>
> tempSearchers[i] = searchables[i].getSearcher(callerContext);
>
> readers[i] = (tempSearchers[i]).getIndexReader();
>
> }
>
> MultiReader multiReader = new MultiReader(readers, false);
>
> IndexSearcher searcher = new IndexSearcher(multiReader);
>
>
>
> and releasing the searchManager using the below code-
>
>
>
> *for* (*int* i = 0; i < searchables.length; i++)
>
> *try*
>
> {
>
> searchables[i].releaseSearcher(tempSearchers[i]);
>
>       }
>
> *catch* (IOException e)
>
> {
>
> *mLogger*.logException(Level.*ERROR*, callerContext, *mSrcInfo*, "Falied
> to release searcher ", e);
>
> }
>
> }
>
>
>
> Do you think it’s right way to use MultiSearcher? If not, please suggest a
> way to use MultiSearcher.
>
>
>
> Thanks,
>
> Mukul Ranjan
>
>
>
> *From:* Michael McCandless [mailto:lucene@mikemccandless.com]
> *Sent:* Friday, June 17, 2016 3:28 PM
> *To:* Mukul Ranjan <mr...@egain.com>
>
> *Subject:* Re: LockFactory issue observed in lucene while getting
> instance of indexWriter
>
>
>
> Why do you need to close and reopen the IndexWriter?  Can you leave it
> open indefinitely?
>
>
>
> Another option is to get a new Directory instance each time you want to
> open a new IndexWriter.
>
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
>
> On Fri, Jun 17, 2016 at 5:02 AM, Mukul Ranjan <mr...@egain.com> wrote:
>
> No, We are not opening  any near-real-time readers, but still the issue
> coming.
>
>
>
> Thanks,
>
> Mukul
>
>
>
> *From:* Michael McCandless [mailto:lucene@mikemccandless.com]
> *Sent:* Friday, June 17, 2016 12:56 AM
> *To:* Mukul Ranjan <mr...@egain.com>
> *Cc:* Lucene Users <ja...@lucene.apache.org>
>
> *Subject:* Re: LockFactory issue observed in lucene while getting
> instance of indexWriter
>
>
>
> But do you open any near-real-time readers from this writer?
>
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
>
> On Thu, Jun 16, 2016 at 1:01 PM, Mukul Ranjan <mr...@egain.com> wrote:
>
> Hi Michael,
>
>
>
> Thanks for your reply.
>
> I’m running it on windows. I have checked my code, I’m closing IndexWriter
> after adding document to it.
>
> We are not getting this issue always but it’s frequency is high in our
> application. Can you please provide your suggestion?
>
>
>
> Thanks,
>
> Mukul
>
>
>
> *From:* Michael McCandless [mailto:lucene@mikemccandless.com]
> *Sent:* Thursday, June 16, 2016 10:22 PM
> *To:* Lucene Users <ja...@lucene.apache.org>; Mukul Ranjan <
> mranjan@egain.com>
> *Subject:* Re: LockFactory issue observed in lucene while getting
> instance of indexWriter
>
>
>
> Are you running on Windows?
>
>
>
> This is not a LockFactory issue ... it's likely caused because you closed
> IndexWriter, and then opened a new one, before closing NRT readers you had
> opened from the first writer?
>
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
>
> On Thu, Jun 16, 2016 at 6:19 AM, Mukul Ranjan <mr...@egain.com> wrote:
>
> Hi,
>
> I'm observing below exception while getting instance of indexWriter-
>
> java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName"
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746 still
> has pending deleted files; cannot initialize IndexWriter
>
> Is it related to the default used NativeFSLockFactory. Should I use
> simpleFSLockFactory to avoid this type of issue. Please suggest as I'm
> getting the above exception in my application.
>
> Thanks,
> Mukul
> Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and
> LinkedIn<https://www.linkedin.com/company/egain-corporation>
>
>
>
>
>
>
>

Re: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Michael McCandless <lu...@mikemccandless.com>.
But do you open any near-real-time readers from this writer?

Mike McCandless

http://blog.mikemccandless.com

On Thu, Jun 16, 2016 at 1:01 PM, Mukul Ranjan <mr...@egain.com> wrote:

> Hi Michael,
>
>
>
> Thanks for your reply.
>
> I’m running it on windows. I have checked my code, I’m closing IndexWriter
> after adding document to it.
>
> We are not getting this issue always but it’s frequency is high in our
> application. Can you please provide your suggestion?
>
>
>
> Thanks,
>
> Mukul
>
>
>
> *From:* Michael McCandless [mailto:lucene@mikemccandless.com]
> *Sent:* Thursday, June 16, 2016 10:22 PM
> *To:* Lucene Users <ja...@lucene.apache.org>; Mukul Ranjan <
> mranjan@egain.com>
> *Subject:* Re: LockFactory issue observed in lucene while getting
> instance of indexWriter
>
>
>
> Are you running on Windows?
>
>
>
> This is not a LockFactory issue ... it's likely caused because you closed
> IndexWriter, and then opened a new one, before closing NRT readers you had
> opened from the first writer?
>
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
>
> On Thu, Jun 16, 2016 at 6:19 AM, Mukul Ranjan <mr...@egain.com> wrote:
>
> Hi,
>
> I'm observing below exception while getting instance of indexWriter-
>
> java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName"
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746 still
> has pending deleted files; cannot initialize IndexWriter
>
> Is it related to the default used NativeFSLockFactory. Should I use
> simpleFSLockFactory to avoid this type of issue. Please suggest as I'm
> getting the above exception in my application.
>
> Thanks,
> Mukul
> Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and
> LinkedIn<https://www.linkedin.com/company/egain-corporation>
>
>
>

RE: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Mukul Ranjan <mr...@egain.com>.
Hi Michael,

Thanks for your reply.
I’m running it on windows. I have checked my code, I’m closing IndexWriter after adding document to it.
We are not getting this issue always but it’s frequency is high in our application. Can you please provide your suggestion?

Thanks,
Mukul

From: Michael McCandless [mailto:lucene@mikemccandless.com]
Sent: Thursday, June 16, 2016 10:22 PM
To: Lucene Users <ja...@lucene.apache.org>; Mukul Ranjan <mr...@egain.com>
Subject: Re: LockFactory issue observed in lucene while getting instance of indexWriter

Are you running on Windows?

This is not a LockFactory issue ... it's likely caused because you closed IndexWriter, and then opened a new one, before closing NRT readers you had opened from the first writer?

Mike McCandless

http://blog.mikemccandless.com

On Thu, Jun 16, 2016 at 6:19 AM, Mukul Ranjan <mr...@egain.com>> wrote:
Hi,

I'm observing below exception while getting instance of indexWriter-

java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName" lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746<ma...@1ec79746> still has pending deleted files; cannot initialize IndexWriter

Is it related to the default used NativeFSLockFactory. Should I use simpleFSLockFactory to avoid this type of issue. Please suggest as I'm getting the above exception in my application.

Thanks,
Mukul
Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and LinkedIn<https://www.linkedin.com/company/egain-corporation>


Re: LockFactory issue observed in lucene while getting instance of indexWriter

Posted by Michael McCandless <lu...@mikemccandless.com>.
Are you running on Windows?

This is not a LockFactory issue ... it's likely caused because you closed
IndexWriter, and then opened a new one, before closing NRT readers you had
opened from the first writer?

Mike McCandless

http://blog.mikemccandless.com

On Thu, Jun 16, 2016 at 6:19 AM, Mukul Ranjan <mr...@egain.com> wrote:

> Hi,
>
> I'm observing below exception while getting instance of indexWriter-
>
> java.lang.IllegalArgumentException: Directory MMapDirectory@"directoryName"
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@1ec79746 still
> has pending deleted files; cannot initialize IndexWriter
>
> Is it related to the default used NativeFSLockFactory. Should I use
> simpleFSLockFactory to avoid this type of issue. Please suggest as I'm
> getting the above exception in my application.
>
> Thanks,
> Mukul
> Visit eGain on YouTube<https://www.youtube.com/user/egainchannel> and
> LinkedIn<https://www.linkedin.com/company/egain-corporation>
>