Thank you.
I'm not doing any optimize other then the one at startup and after adding a
new post.
And I'm 100% sure nobody added a post between startup and when, after a few
hours, the apppool was restarted.
Simo

On Tue, Jan 5, 2010 at 12:03 AM, Franklin Simmons <
[email protected]> wrote:

> Simone,
>
> Is it possible that an optimize is exceeding any of the application pool's
> time out settings?  Optimize can be a lengthy process (for large indexes).
>  I am not intimate with the behavior of IIS's process termination, but
> summarily killing a process in the midst of an optimize can be problematic.
>
>
> -----Original Message-----
> From: Simone Chiaretta [mailto:[email protected]]
> Sent: Monday, January 04, 2010 4:17 PM
> To: lucene-net-user
> Subject: "Lock obtain timed out: SimpleFSLock" appearing sometimes
>
> Hi all,
> since it's my first time here I'd like to introduce myself.
> My name is Simone Chiaretta, and I'm member of Subtext blogging engine
> team,
> and I'm a ASP.NET MVC fan.
> I also have a blog at http://codeclimber.net.nz, where I also wrote a few
> posts about Lucene.net
>
> But going back to the main topic of this email: I'm implementing a
> Lucene.net based search engine for Subtext and I'm writing because I've a
> strange problem that happens from times to times:
> I get the exception of the subject "Lock obtain timed out: SimpleFSLock..."
> every now and then when the ApplicationPool recycles.
>
> I know only one IndexWriter can exist at a time, and in fact the writer is
> a
> static variable inside the search engine service.
>
> The problem seems that the Dispose of the search engine, which closes the
> writer is not enough for releasing the lock.
>
>        public void Dispose()
>        {
>            var searcher = _searcher;
>            if (searcher != null)
>            {
>                searcher.Close();
>            }
>
>            var writer = _writer;
>            if (writer != null)
>            {
>                writer.Close();
>            }
>
>            var directory = _directory;
>            if(directory != null) {
>              directory.Close();
>            }
>
>            writer = _writer;
>            if (writer != null)
>            {
>                _writer = null;
>            }
>        }
>
> For the moment I made 2 workaround that I hope will solve the problem:
>
> I'm checking weather the index is locked or not before creating a new one
>
> if(_writer==null)
> {
>    if(IndexReader.IsLocked(_directory))
>    {
>        __log.Error("Something left a lock in the index folder: deleting
> it");
>        IndexReader.Unlock(_directory);
>        __log.Info("Lock Deleted... can proceed");
>    }
>    _writer = new IndexWriter(_directory, _analyzer);
>    _writer.Optimize();
> }
>
> and I'm explicitly disposing the search engine in the Application_End event
> of the WebApplication
>
> searchEngine.Dispose();
>
> But I'd like to know if maybe I'm making some mistake somewhere that is
> causing the problem, or if there is a more elegant way to fix this problem.
>
> For a complete reference here is the link to the latest version of the
> SearchEngineService class that encapsulate all the fulltext searching logic
> of Subtext
>
> http://code.google.com/p/subtext/source/browse/trunk/src/Subtext.Framework/Services/SearchEngine/SearchEngineService.cs
>
> Oh... one last thing.. I'm using Lucene.net 2.3.2
>
> Thank you
> Simone
>
>
> --
> Simone Chiaretta
> Microsoft MVP ASP.NET - ASPInsider
> Blog: http://codeclimber.net.nz
> RSS: http://feeds2.feedburner.com/codeclimber
> twitter: @simonech
>
> Any sufficiently advanced technology is indistinguishable from magic
> "Life is short, play hard"
>



-- 
Simone Chiaretta
Microsoft MVP ASP.NET - ASPInsider
Blog: http://codeclimber.net.nz
RSS: http://feeds2.feedburner.com/codeclimber
twitter: @simonech

Any sufficiently advanced technology is indistinguishable from magic
"Life is short, play hard"

Reply via email to