Hey,

It turned out that FSDirectory is trying to use NIOFSDirectory
under Unix. See the attached patch.

With this patch, Arne's test case is running well under Mono 2-6
and Mono trunk but not with 2-4.

Robert


On 02.04.2010 01:19, Michael Garski wrote:
Arne,

It appears as if you are using NIOFSDirectory, which is not implemented in 
Lucene.Net.

Is that the case?  If so, try using FSDirectory instead.

Michael

-----Original Message-----
From: Digy [mailto:digyd...@gmail.com]
Sent: Thursday, April 01, 2010 4:03 PM
To: lucene-net-dev@lucene.apache.org
Subject: RE: Lucene.net 2.9.1 and mono

Houston, we have a problem :-( Can you provide a sample (and simple) code
for 2.9.1 showing the bug?
When I get time, I want to try it on my old mono.

For your other question
Before i go into the 2.9.1 issues in detail, in 2.40 is there a best
practice for cleaning up lingering locks for SimpleFSLock other than
manually looking for the lock file and clearing it out at startup?
You can use "IndexReader.Unlock"

DIGY

-----Original Message-----
From: Arne Claassen [mailto:ar...@mindtouch.com]
Sent: Friday, April 02, 2010 1:58 AM
To: lucene-net-dev@lucene.apache.org
Subject: Re: Lucene.net 2.9.1 and mono

Everything is compiled on windows, VS2k8 and deployed to mono.

Arne Claassen

MindTouch
San Diego, CA
http://twitter.com/sdether

On Apr 1, 2010, at 3:40 PM, Digy wrote:

Where do you compile Lucene.Net? If on mono, try compiling on
windows with
VS  because I also have observed some
strange behaviours after compiling on mono ( since it was far long
ago, I
don't remember what it is was anymore).

DIGY

-----Original Message-----
From: Arne Claassen [mailto:ar...@mindtouch.com]
Sent: Friday, April 02, 2010 1:29 AM
To: lucene-net-dev@lucene.apache.org
Subject: Lucene.net 2.9.1 and mono

Hi, i'm new to the list, so if this falls under FAQ, please just point
me in the right direction.

We've been using Lucene.net 1.9.1 for quite a while and I wanted to
finally get us current with lucene, so i incorporated 2.9.1 into our
code. Unfortunately, 2.9.1 crashes under mono 2.4. Has anyone else
tried it on Mono? I downgraded to 2.4.0 which does work but has
problems with unclean shutdown with SimpleFSLock on windows and linux,
that NativeFSLock in 2.9.1 does not exhibit.

Before i go into the 2.9.1 issues in detail, in 2.40 is there a best
practice for cleaning up lingering locks for SimpleFSLock other than
manually looking for the lock file and clearing it out at startup?

Anyway, here are the 2.9.1 issues i came across. Being mono only
issues i don't know if this helpful, but i thought i'd see if this
rings a bell.

When no index exists yet, IndexWriter will die and completely take
down the process with this:

** ERROR:(mini.c:3624):mini_method_compile: assertion failed: (tblock-
native_offset)
Stacktrace:

   at Lucene.Net.Index.SegmentInfos.FinishCommit
(Lucene.Net.Store.Directory)<0xffffffff>
   at Lucene.Net.Index.SegmentInfos.FinishCommit
(Lucene.Net.Store.Directory)<0x000e4>
   at Lucene.Net.Index.SegmentInfos.Commit
(Lucene.Net.Store.Directory)<0x00024>
   at Lucene.Net.Index.IndexWriter.Init
(Lucene
.Net
.Store
.Directory
,Lucene
.Net
.Analysis
.Analyzer
,bool
,bool
,Lucene
.Net
.Index.IndexDeletionPolicy,bool,int,Lucene.Net.Index.DocumentsWriter/
IndexingChain,Lucene.Net.Index.IndexCommit)<0x001a3>
   at Lucene.Net.Index.IndexWriter.Init
(Lucene
.Net
.Store
.Directory
,Lucene
.Net
.Analysis
.Analyzer
,bool
,Lucene
.Net
.Index.IndexDeletionPolicy,bool,int,Lucene.Net.Index.DocumentsWriter/
IndexingChain,Lucene.Net.Index.IndexCommit)<0x00076>
   at Lucene.Net.Index.IndexWriter..ctor
(Lucene
.Net
.Store
.Directory,Lucene.Net.Analysis.Analyzer,Lucene.Net.Index.IndexWriter/
MaxFieldLength)<0x001c2>
   at Repro.Program.Main (string[])<0x00089>
   at (wrapper runtime-invoke)
Repro.Program.runtime_invoke_void_object (object,intptr,intptr,intptr)
<0xffffffff>

If an index already exists both IndexWriter and IndexSearcher will
throw an exception (without taking down the process this time) for
NIOFSDirectory:

Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object
   at Lucene.Net.Store.NIOFSDirectory+NIOFSIndexInput.ReadInternal
(System.Byte[] b, Int32 offset, Int32 len) [0x00000]
   at Lucene.Net.Store.BufferedIndexInput.Refill () [0x00000]
   at Lucene.Net.Store.BufferedIndexInput.ReadByte () [0x00000]
   at Lucene.Net.Store.IndexInput.ReadInt () [0x00000]
   at Lucene.Net.Index.SegmentInfos+FindSegmentsFile.Run
(Lucene.Net.Index.IndexCommit commit) [0x00000]
   at Lucene.Net.Index.DirectoryReader.Open
(Lucene.Net.Store.Directory directory, IndexDeletionPolicy
deletionPolicy, Lucene.Net.Index.IndexCommit commit, Boolean readOnly,
Int32 termInfosIndexDivisor) [0x00000]
   at Lucene.Net.Index.IndexReader.Open (Lucene.Net.Store.Directory
directory, IndexDeletionPolicy deletionPolicy,
Lucene.Net.Index.IndexCommit commit, Boolean readOnly, Int32
termInfosIndexDivisor) [0x00000]
   at Lucene.Net.Index.IndexReader.Open (Lucene.Net.Store.Directory
directory) [0x00000]
   at Lucene.Net.Search.IndexSearcher..ctor
(Lucene.Net.Store.Directory directory) [0x00000]
   at (wrapper remoting-invoke-with-check)
Lucene.Net.Search.IndexSearcher:.ctor (Lucene.Net.Store.Directory)
   at Repro.Program.Main (System.String[] args) [0x00000]

I've also come across lock timeout with NativeFSLock on mono, but
can't figure out how to repro this.

cheers,
Arne Claassen

MindTouch
San Diego, CA
http://twitter.com/sdether




Index: src/Lucene.Net/Store/FSDirectory.cs
===================================================================
--- src/Lucene.Net/Store/FSDirectory.cs (revision 930531)
+++ src/Lucene.Net/Store/FSDirectory.cs (working copy)
@@ -559,14 +559,7 @@
                        return dir;
                        */
                        
-                       if (Constants.WINDOWS)
-                       {
-                               return new SimpleFSDirectory(path, lockFactory);
-                       }
-                       else
-                       {
-                               return new NIOFSDirectory(path, lockFactory);
-                       }
+                       return new SimpleFSDirectory(path, lockFactory);
         }
                
                /* will move to ctor, when reflection is removed in 3.0 */

Reply via email to