lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pauli Østerø (JIRA) <j...@apache.org>
Subject [jira] Commented: (LUCENENET-113) adding documents to index does, in rare cases, cause an access denied to segments.gen
Date Fri, 18 Apr 2008 15:44:21 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590489#action_12590489
] 

Pauli Østerø commented on LUCENENET-113:
----------------------------------------

digy> The case is really simple. I have a an update routine that either creates or opens
my index, delete all the documents and adds new ones to it

IndexWriter indexWriter;

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
                indexWriter = new Lucene.Net.Index.IndexWriter(this.dir, new StandardAnalyzer(),
true);
            }
            else
            {
                deleteDocuments();
                indexWriter = new Lucene.Net.Index.IndexWriter(this.dir, new StandardAnalyzer(),
false);
            }

            addSpeeddial(indexWriter);
            addEmployees(indexWriter);

            indexWriter.Optimize();
            indexWriter.Close();

the UnauthorizedException always appears in either addSpeeddial or AddEmployees, which is
basicly just routines for fetching out information from a database and adding a document

                ... create fields-stringbuilder
                doc.Add(new Field("fields", fields.ToString().Trim(), Field.Store.NO, Field.Index.TOKENIZED));
                addDocument(doc, writer);

And now in my addDocument i have my try catch

private void addDocument(Document doc, IndexWriter writer)
        {
            try
            {
                writer.AddDocument(doc);
            }
            catch (UnauthorizedAccessException exc)
            {
                Thread.Sleep(100);
                writer.AddDocument(doc);
            }
        }

The bug appeared when releasing the code into production, and i think the reason why i havent
experienced it in development is because my testmachines have a rather slow connection to
the database meaning that  addDocument() wasn't beeing called so rapidly as on my production
environment.

I'll look into the cache of files-thing, but i doubt it since its on a production server without
svn or stuff like that.

> adding documents to index does, in rare cases, cause an access denied to segments.gen
> -------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-113
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-113
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: Windows 2003
> Lucene.Net 2.1.0.3
>            Reporter: Pauli Østerø
>            Priority: Critical
>
> When updating an index via an indexwriter, does cause an access denied for segments.gen.
> After investigation with FileMon the problem seems to be Lucene deleting and creating
the segments.gen with such a speed, that Windows occasionally reports "DELETE PEND" when trying
to open the file, which causes Lucene to crash.
> A quick fix has been to do a try-catch when adding documents, and sleeping the thread
for 100 ms when encountering the UnathorizedException and trying to add the document again.

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


Mime
View raw message