Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Aug 02, 2009 @ 17:32
    Morten Bock
    0

    Lucene problem when creating a lot of nodes

    I am importing my old blogposts into umbraco using the API. At the same time I have an eventhandler that creates datefolders for me. After 10-15 seconds of importing, I get this error in the eventlog, a big "Server application unavailable" message on the page:

    -------------------

    An unhandled exception occurred and the process was terminated.

    Application ID: /LM/W3SVC/22/ROOT

    Process ID: 2484

    Exception: System.IO.IOException

    Message: The process cannot access the file 'C:\Documents and Settings\MORTEN\ASPNET\Lokale indstillinger\Temp\lucene-12e99fcf6eebeb93b924d4f5cd37e71f-write.lock' because it is being used by another process.

    StackTrace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.File.Delete(String path)
       at Lucene.Net.Store.FSDirectory.AnonymousClassLock.Release()
       at Lucene.Net.Index.IndexWriter.Finalize()

    ---------------------

    I am guessing that it happens because the events fire in a new thread, so I am basically creating and publishing nodes in severral threads at the same time.

    Have any of you experienced this, and gotten around it? Should I make my import loop slower so that the events get some time to complete, or what would be the way to go?

    can I turn off the lucene indexing all together?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Aug 02, 2009 @ 18:05
    Morten Bock
    1

    Ok, so I googled a bit, and found that this line of code should disable locking in lucene:

    Lucene.Net.Store.FSDirectory.SetDisableLocks(true);
    And it seemes to work. I'm not sure what effect this will have on the index (if it will break), but at least my import can complete.

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Aug 03, 2009 @ 12:16
    Chris Houston
    0

    Hi Morten,

    I have also come across the same error today while importing about 1000 pages from a 3rd party CMS into Umbraco using the API's. I am also creating a folder structure and then importing the documents into this structure.

    I will give your line of code a try.. and will post a follow up later :)

    Cheers,

    Chris

  • Steven Wilber 103 posts 98 karma points
    Sep 02, 2009 @ 17:04
    Steven Wilber
    0

    Hi,

    I'm having the exact same problems, despite the bit of code suggested above.

    Did this solve the problem for you in the end, or did you find another work around.

    Ideally I'll like to stop Lucene altogether until our import of lots of nodes is complete and then start it again afterwards. Does anyone know how to do this.

     

    Cheers

     

    Steve

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 02, 2009 @ 18:44
    Morten Bock
    0

    Hi Steven

    The code solved the problem for me, so I didn't dig any further into the matter.

  • Steven Wilber 103 posts 98 karma points
    Sep 03, 2009 @ 10:52
    Steven Wilber
    0

    Cheers,

    I'm looking into some other options to keep the page alive whilst creating the nodes, I'll see if that helps.

    Thanks for your update anyway. It is good to know.

    Cheers

    Steve

  • Steven Wilber 103 posts 98 karma points
    Sep 03, 2009 @ 13:24
    Steven Wilber
    0

    I eventually seem to have cracked the problem by putting the code above in the Application_Start.

    Not perfect, but it did not seem to work anywhere else.

    Still only tested it a bunch of times so far, so maybe I was just lucky.

    Cheers

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft