You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Vova Tymchenko <ha...@yahoo.com> on 2007/03/29 11:37:34 UTC

Possible bug(s) in SegmentReader and TermInfosReader

Hello everybody,

I'm using Lucene.Net with my own implementation of Directory which stores the files in the SQL database.
Additionally, it maintains the reference count for the locks created in the directory. One thing I noticed is
that there are locks left behind sometimes. Eventually, I tracked the problem down to SegmentReader.

The trouble that I see with SegmentReader (and TermInfosReader as well) is that it stores references
to TermVectorsReader in ThreadLocalStore when GetTermVectorsReader is called, but .Close method fails
to close and clean up that reference.

The change that I've implemented in my local copy of Lucene (and which seems to work) is like this - I added
the following code to the beginning of DoClose in SegmentReader:

            TermVectorsReader tvReader = (TermVectorsReader) System.Threading.Thread.GetData(termVectorsLocal);

            if (tvReader != null)
            {
                tvReader.Close();
                System.Threading.Thread.SetData(termVectorsLocal, null);
            }

The following change has been done to TermInfosReader:

            SegmentTermEnum termEnum = (SegmentTermEnum) System.Threading.Thread.GetData(enumerators);

            if (termEnum != null)
            {
                termEnum.Close();
                System.Threading.Thread.SetData(enumerators, null);
            }

Regards,
Volodymyr.




 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

RE: Possible bug(s) in SegmentReader and TermInfosReader

Posted by George Aroush <ge...@aroush.net>.
Hi Vova,

I have posted your question to the Lucene.Net mailing list.  Please
subscribe so you can post directly and actually read any response to your
question.  See the section "Mailing Lists"
http://incubator.apache.org/lucene.net/ for how to subscribe.  Basically,
just send an email to lucene-net-dev-subscribe@incubator.apache.org. and /
or lucene-net-user-subscribe@incubator.apache.org.

-- George Aroush

-----Original Message-----
From: Vova Tymchenko [mailto:halleck1@yahoo.com] 
Sent: Thursday, March 29, 2007 5:38 AM
To: lucene-net-dev@incubator.apache.org
Subject: Possible bug(s) in SegmentReader and TermInfosReader

Hello everybody,

I'm using Lucene.Net with my own implementation of Directory which stores
the files in the SQL database.
Additionally, it maintains the reference count for the locks created in the
directory. One thing I noticed is that there are locks left behind
sometimes. Eventually, I tracked the problem down to SegmentReader.

The trouble that I see with SegmentReader (and TermInfosReader as well) is
that it stores references to TermVectorsReader in ThreadLocalStore when
GetTermVectorsReader is called, but .Close method fails to close and clean
up that reference.

The change that I've implemented in my local copy of Lucene (and which seems
to work) is like this - I added the following code to the beginning of
DoClose in SegmentReader:

            TermVectorsReader tvReader = (TermVectorsReader)
System.Threading.Thread.GetData(termVectorsLocal);

            if (tvReader != null)
            {
                tvReader.Close();
                System.Threading.Thread.SetData(termVectorsLocal, null);
            }

The following change has been done to TermInfosReader:

            SegmentTermEnum termEnum = (SegmentTermEnum)
System.Threading.Thread.GetData(enumerators);

            if (termEnum != null)
            {
                termEnum.Close();
                System.Threading.Thread.SetData(enumerators, null);
            }

Regards,
Volodymyr.




 
____________________________________________________________________________
________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL