FileNotFoundException "segments.gen" when running store in memory and debugger attached

1,291 views
Skip to first unread message

Udengaard

unread,
Jun 22, 2011, 6:53:22 AM6/22/11
to ravendb
Hi,

Im getting an error in Lucene.Net, using latest RavenDB build 371.
The error occours in the following line in my code (the first query
being executed):

Session.Query<User>().Where(x => x.Username ==
username).SingleOrDefault();

The stacktrace is:
System.IO.FileNotFoundException occurred
Message=segments.gen
Source=Lucene.Net
StackTrace:
at Lucene.Net.Store.RAMDirectory.OpenInput(String name) in z:
\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net\Store
\RAMDirectory.cs:line 301

The weirdest part is that the error only occours when i run my tests
with debugger attached?

This is what my store setup looks like (using windsor):
public class TestPersistenceFacility : AbstractFacility
{
protected override void Init()
{

Kernel.Register(Component.For<IDocumentStore>().UsingFactoryMethod(CreateDocumentStore));

Kernel.Register(Component.For<IDocumentSession>().UsingFactoryMethod(OpenSession));
}

protected IDocumentSession OpenSession(IKernel kernel)
{
return kernel.Resolve<IDocumentStore>().OpenSession();
}

protected IDocumentStore CreateDocumentStore()
{
var store = new EmbeddableDocumentStore
{
RunInMemory = true
};
store.Initialize();
return store;
}
}

Am i doing something wrong? :-)

Regard,
Lars

Ayende Rahien

unread,
Jun 22, 2011, 6:56:45 AM6/22/11
to rav...@googlegroups.com
This isn't an issue, the exception is handled internally, and you won't see it in your code.

Udengaard

unread,
Jun 22, 2011, 7:12:49 AM6/22/11
to ravendb
Thanks for the quick response,

I had actually seen that it was a first chance exception, but it is
just the first of a series of exceptions, which is thrown and
ultimatly ends up with no 'User' being returned from the query.
I then (probably mistakenly :-)) assumed that all other errors
originated from the first error.
Here is all the exceptions, in the sequence of which the occour. Note
they are alle first chance, but the Query from above now no longer
returns anything, although it works fine with no debugger attach.

System.IO.FileNotFoundException occurred
Message=segments.gen
Source=Lucene.Net
StackTrace:
at Lucene.Net.Store.RAMDirectory.OpenInput(String name) in z:
\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net\Store
\RAMDirectory.cs:line 301
InnerException:

System.IO.FileNotFoundException occurred
Message=no segments* file found in Lucene.Net.Store.RAMDirectory:
files:
Source=Lucene.Net
StackTrace:
at
Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run(IndexCommit commit)
in z:\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net
\Index\SegmentInfos.cs:line 761
InnerException:

Lucene.Net.QueryParsers.QueryParser.LookaheadSuccess occurred
Message=Error in the application.
Source=Lucene.Net
StackTrace:
at Lucene.Net.QueryParsers.QueryParser.Jj_scan_token(Int32
kind) in z:\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src
\Lucene.Net\QueryParser\QueryParser.cs:line 2182
InnerException:

System.IO.IOException occurred
Message=read past eof
Source=Lucene.Net
StackTrace:
at Lucene.Net.QueryParsers.FastCharStream.Refill() in z:
\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net
\QueryParser\FastCharStream.cs:line 89
InnerException:

System.IO.IOException occurred
Message=read past eof
Source=Lucene.Net
StackTrace:
at Lucene.Net.QueryParsers.FastCharStream.Refill() in z:
\Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net
\QueryParser\FastCharStream.cs:line 89
InnerException:



On 22 Jun., 12:56, Ayende Rahien <aye...@ayende.com> wrote:
> This isn't an issue, the exception is handled internally, and you won't see
> it in your code.
>
>
>
> On Wed, Jun 22, 2011 at 1:53 PM, Udengaard <l...@udengaard.org> wrote:
> > Hi,
>
> > Im getting an error in Lucene.Net, using latest RavenDB build 371.
> > The error occours in the following line in my code (the first query
> > being executed):
>
> > Session.Query<User>().Where(x => x.Username ==
> > username).SingleOrDefault();
>
> > The stacktrace is:
> > System.IO.FileNotFoundException occurred
> >  Message=segments.gen
> >  Source=Lucene.Net
> >  StackTrace:
> >       at Lucene.Net.Store.RAMDirectory.OpenInput(String name) in z:
> > \Projects\ravendb\SharedLibs\Sources\Lucene2.9.2\src\Lucene.Net\Store
> > \RAMDirectory.cs:line 301
>
> > The weirdest part is that the error only occours when i run my tests
> > with debugger attached?
>
> > This is what my store setup looks like (using windsor):
> >    public class TestPersistenceFacility : AbstractFacility
> >    {
> >        protected override void Init()
> >        {
>
> > Kernel.Register(Component.For<IDocumentStore>().UsingFactoryMethod(CreateDo­cumentStore));
>
> > Kernel.Register(Component.For<IDocumentSession>().UsingFactoryMethod(OpenSe­ssion));
> >        }
>
> >        protected IDocumentSession OpenSession(IKernel kernel)
> >        {
> >            return kernel.Resolve<IDocumentStore>().OpenSession();
> >        }
>
> >        protected IDocumentStore CreateDocumentStore()
> >        {
> >            var store = new EmbeddableDocumentStore
> >            {
> >                RunInMemory = true
> >            };
> >            store.Initialize();
> >            return store;
> >        }
> >    }
>
> > Am i doing something wrong? :-)
>
> > Regard,
> > Lars- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

Ayende Rahien

unread,
Jun 22, 2011, 7:18:02 AM6/22/11
to rav...@googlegroups.com
Yeah, those are annoying, but they won't cause a problem.
Did you add WaitForNonStaleResultsAsOfNow() ?

Udengaard

unread,
Jun 22, 2011, 7:36:47 AM6/22/11
to ravendb
Arh, duh, youre right. The exceptions and the fact it worked when the
debugger wasnt attached had me looking all the wrong places.
The problem was the query it self.

Thank you for your help!
> > > - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -
Reply all
Reply to author
Forward
0 new messages