You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Phil Herold <he...@gmail.com> on 2014/08/19 17:27:02 UTC

IndexReader.removeReaderClosedListener

The implementation of this final method (latest 4.9 code) calls ensureOpen(),
which fails, since the reader is closed. As a result, this method doesn't
work. It seems as if this is therefore a potential memory leak,  not being
able to remove the listener. Or am I missing something?

--
Phil

Re: IndexReader.removeReaderClosedListener

Posted by Shai Erera <se...@gmail.com>.
But that also implies that your search app holds a reference to the closed
IndexReader ...

Shai


On Wed, Aug 20, 2014 at 6:17 PM, Phil Herold <ph...@nc.rr.com> wrote:

> If the IndexReader is still holding a reference to the listener in its
> collection, I don't see how it could be GC'ed. This is a pretty classic
> memory leak case.
>
> --
> Phil
>
>
> On Wed, Aug 20, 2014 at 11:15 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
>
>> Yeah,
>>
>>
>>
>> I dont see the memory leak, too. After you closed the IndexReader its
>> free for garbage collection. So it should no longer block the listener to
>> be GCed.
>>
>>
>>
>> Uwe
>>
>>
>>
>> -----
>>
>> Uwe Schindler
>>
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>>
>> http://www.thetaphi.de
>>
>> eMail: uwe@thetaphi.de
>>
>>
>>
>> *From:* Shai Erera [mailto:serera@gmail.com]
>> *Sent:* Wednesday, August 20, 2014 5:10 PM
>> *To:* dev@lucene.apache.org
>> *Subject:* Re: IndexReader.removeReaderClosedListener
>>
>>
>>
>> I don't understand something -- you add a ReaderClosedListener to get a
>> notification when IR.close() is called (actually, when it's actually being
>> closed). Why removing the listener after the reader has been closed? Don't
>> apps usually nullify their IR member after it's been closed?
>>
>> Shai
>>
>>
>>
>> On Wed, Aug 20, 2014 at 5:51 PM, Phil Herold <ph...@nc.rr.com> wrote:
>>
>> Fine. I'm sure you've got a good reason for this. But it is totally
>> un-intuitive, and introduces a potential memory leak, IMO. The
>> implementation of this pattern is definitely different than just about any
>> other library I can think of.
>>
>>
>>
>> Given that having a listener for index closed doesn't really solve the
>> issue I was having that I was hoping it would, it doesn't much matter to me
>> at this point.
>>
>>
>>
>> Thanks.
>>
>>
>>
>> --
>>
>> Phil
>>
>>
>>
>> On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <rc...@gmail.com> wrote:
>>
>> I don't agree. Operations like this shouldnt be performed on closed
>> readers.
>>
>> the ensureOpen is correct.
>>
>>
>> On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
>> > Bingo. ensureOpen() should not be called from this method. Thanks.
>> >
>> > --
>> > Phil
>> >
>> >
>> >
>> > On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
>> >>
>> >> Hi,
>> >>
>> >> In my opinion, removing the listener before close looks wrong. Because
>> you
>> >> would not get the listener events for the explicit close of the
>> >> DirectoryReader.
>> >>
>> >> I would just remove the ensureOpen(). We should open issue.
>> >>
>> >> Uwe
>> >> -----
>> >> Uwe Schindler
>> >> H.-H.-Meier-Allee 63, D-28213 Bremen
>> >> http://www.thetaphi.de
>> >> eMail: uwe@thetaphi.de
>> >>
>> >>
>> >> > -----Original Message-----
>> >> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
>> >> > Sent: Wednesday, August 20, 2014 9:53 AM
>> >> > To: Lucene/Solr dev; Phil Herold
>> >> > Subject: Re: IndexReader.removeReaderClosedListener
>> >> >
>> >> > Hmm, you should call this method before closing the IndexReader, to
>> >> > remove a listener you previously added.
>> >> >
>> >> > Mike McCandless
>> >> >
>> >> > http://blog.mikemccandless.com
>> >> >
>> >> >
>> >> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <herold.phil@gmail.com
>> >
>> >> > wrote:
>> >> > > The implementation of this final method (latest 4.9 code) calls
>> >> > > ensureOpen(), which fails, since the reader is closed. As a result,
>> >> > > this method doesn't work. It seems as if this is therefore a
>> potential
>> >> > > memory leak,  not being able to remove the listener. Or am I
>> missing
>> >> > something?
>> >> > >
>> >> > > --
>> >> > > Phil
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
>> additional
>> >> > commands, e-mail: dev-help@lucene.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> >> For additional commands, e-mail: dev-help@lucene.apache.org
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
>>
>>
>>
>
>

Re: IndexReader.removeReaderClosedListener

Posted by Phil Herold <ph...@nc.rr.com>.
If the IndexReader is still holding a reference to the listener in its
collection, I don't see how it could be GC'ed. This is a pretty classic
memory leak case.

--
Phil


On Wed, Aug 20, 2014 at 11:15 AM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Yeah,
>
>
>
> I dont see the memory leak, too. After you closed the IndexReader its free
> for garbage collection. So it should no longer block the listener to be
> GCed.
>
>
>
> Uwe
>
>
>
> -----
>
> Uwe Schindler
>
> H.-H.-Meier-Allee 63, D-28213 Bremen
>
> http://www.thetaphi.de
>
> eMail: uwe@thetaphi.de
>
>
>
> *From:* Shai Erera [mailto:serera@gmail.com]
> *Sent:* Wednesday, August 20, 2014 5:10 PM
> *To:* dev@lucene.apache.org
> *Subject:* Re: IndexReader.removeReaderClosedListener
>
>
>
> I don't understand something -- you add a ReaderClosedListener to get a
> notification when IR.close() is called (actually, when it's actually being
> closed). Why removing the listener after the reader has been closed? Don't
> apps usually nullify their IR member after it's been closed?
>
> Shai
>
>
>
> On Wed, Aug 20, 2014 at 5:51 PM, Phil Herold <ph...@nc.rr.com> wrote:
>
> Fine. I'm sure you've got a good reason for this. But it is totally
> un-intuitive, and introduces a potential memory leak, IMO. The
> implementation of this pattern is definitely different than just about any
> other library I can think of.
>
>
>
> Given that having a listener for index closed doesn't really solve the
> issue I was having that I was hoping it would, it doesn't much matter to me
> at this point.
>
>
>
> Thanks.
>
>
>
> --
>
> Phil
>
>
>
> On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <rc...@gmail.com> wrote:
>
> I don't agree. Operations like this shouldnt be performed on closed
> readers.
>
> the ensureOpen is correct.
>
>
> On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
> > Bingo. ensureOpen() should not be called from this method. Thanks.
> >
> > --
> > Phil
> >
> >
> >
> > On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
> >>
> >> Hi,
> >>
> >> In my opinion, removing the listener before close looks wrong. Because
> you
> >> would not get the listener events for the explicit close of the
> >> DirectoryReader.
> >>
> >> I would just remove the ensureOpen(). We should open issue.
> >>
> >> Uwe
> >> -----
> >> Uwe Schindler
> >> H.-H.-Meier-Allee 63, D-28213 Bremen
> >> http://www.thetaphi.de
> >> eMail: uwe@thetaphi.de
> >>
> >>
> >> > -----Original Message-----
> >> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
> >> > Sent: Wednesday, August 20, 2014 9:53 AM
> >> > To: Lucene/Solr dev; Phil Herold
> >> > Subject: Re: IndexReader.removeReaderClosedListener
> >> >
> >> > Hmm, you should call this method before closing the IndexReader, to
> >> > remove a listener you previously added.
> >> >
> >> > Mike McCandless
> >> >
> >> > http://blog.mikemccandless.com
> >> >
> >> >
> >> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
> >> > wrote:
> >> > > The implementation of this final method (latest 4.9 code) calls
> >> > > ensureOpen(), which fails, since the reader is closed. As a result,
> >> > > this method doesn't work. It seems as if this is therefore a
> potential
> >> > > memory leak,  not being able to remove the listener. Or am I missing
> >> > something?
> >> > >
> >> > > --
> >> > > Phil
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
> additional
> >> > commands, e-mail: dev-help@lucene.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: dev-help@lucene.apache.org
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>
>
>
>

RE: IndexReader.removeReaderClosedListener

Posted by Uwe Schindler <uw...@thetaphi.de>.
Yeah,

 

I dont see the memory leak, too. After you closed the IndexReader its free for garbage collection. So it should no longer block the listener to be GCed.

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: uwe@thetaphi.de

 

From: Shai Erera [mailto:serera@gmail.com] 
Sent: Wednesday, August 20, 2014 5:10 PM
To: dev@lucene.apache.org
Subject: Re: IndexReader.removeReaderClosedListener

 

I don't understand something -- you add a ReaderClosedListener to get a notification when IR.close() is called (actually, when it's actually being closed). Why removing the listener after the reader has been closed? Don't apps usually nullify their IR member after it's been closed?

Shai

 

On Wed, Aug 20, 2014 at 5:51 PM, Phil Herold <ph...@nc.rr.com> wrote:

Fine. I'm sure you've got a good reason for this. But it is totally un-intuitive, and introduces a potential memory leak, IMO. The implementation of this pattern is definitely different than just about any other library I can think of. 

 

Given that having a listener for index closed doesn't really solve the issue I was having that I was hoping it would, it doesn't much matter to me at this point.

 

Thanks.

 

--

Phil 

 

On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <rc...@gmail.com> wrote:

I don't agree. Operations like this shouldnt be performed on closed readers.

the ensureOpen is correct.


On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
> Bingo. ensureOpen() should not be called from this method. Thanks.
>
> --
> Phil
>
>
>
> On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
>>
>> Hi,
>>
>> In my opinion, removing the listener before close looks wrong. Because you
>> would not get the listener events for the explicit close of the
>> DirectoryReader.
>>
>> I would just remove the ensureOpen(). We should open issue.
>>
>> Uwe
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe@thetaphi.de
>>
>>
>> > -----Original Message-----
>> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
>> > Sent: Wednesday, August 20, 2014 9:53 AM
>> > To: Lucene/Solr dev; Phil Herold
>> > Subject: Re: IndexReader.removeReaderClosedListener
>> >
>> > Hmm, you should call this method before closing the IndexReader, to
>> > remove a listener you previously added.
>> >
>> > Mike McCandless
>> >
>> > http://blog.mikemccandless.com
>> >
>> >
>> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
>> > wrote:
>> > > The implementation of this final method (latest 4.9 code) calls
>> > > ensureOpen(), which fails, since the reader is closed. As a result,
>> > > this method doesn't work. It seems as if this is therefore a potential
>> > > memory leak,  not being able to remove the listener. Or am I missing
>> > something?
>> > >
>> > > --
>> > > Phil
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
>> > commands, e-mail: dev-help@lucene.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org

 

 


Re: IndexReader.removeReaderClosedListener

Posted by Shai Erera <se...@gmail.com>.
I don't understand something -- you add a ReaderClosedListener to get a
notification when IR.close() is called (actually, when it's actually being
closed). Why removing the listener after the reader has been closed? Don't
apps usually nullify their IR member after it's been closed?

Shai


On Wed, Aug 20, 2014 at 5:51 PM, Phil Herold <ph...@nc.rr.com> wrote:

> Fine. I'm sure you've got a good reason for this. But it is totally
> un-intuitive, and introduces a potential memory leak, IMO. The
> implementation of this pattern is definitely different than just about any
> other library I can think of.
>
> Given that having a listener for index closed doesn't really solve the
> issue I was having that I was hoping it would, it doesn't much matter to me
> at this point.
>
> Thanks.
>
> --
> Phil
>
>
> On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <rc...@gmail.com> wrote:
>
>> I don't agree. Operations like this shouldnt be performed on closed
>> readers.
>>
>> the ensureOpen is correct.
>>
>> On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
>> > Bingo. ensureOpen() should not be called from this method. Thanks.
>> >
>> > --
>> > Phil
>> >
>> >
>> >
>> > On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
>> >>
>> >> Hi,
>> >>
>> >> In my opinion, removing the listener before close looks wrong. Because
>> you
>> >> would not get the listener events for the explicit close of the
>> >> DirectoryReader.
>> >>
>> >> I would just remove the ensureOpen(). We should open issue.
>> >>
>> >> Uwe
>> >> -----
>> >> Uwe Schindler
>> >> H.-H.-Meier-Allee 63, D-28213 Bremen
>> >> http://www.thetaphi.de
>> >> eMail: uwe@thetaphi.de
>> >>
>> >>
>> >> > -----Original Message-----
>> >> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
>> >> > Sent: Wednesday, August 20, 2014 9:53 AM
>> >> > To: Lucene/Solr dev; Phil Herold
>> >> > Subject: Re: IndexReader.removeReaderClosedListener
>> >> >
>> >> > Hmm, you should call this method before closing the IndexReader, to
>> >> > remove a listener you previously added.
>> >> >
>> >> > Mike McCandless
>> >> >
>> >> > http://blog.mikemccandless.com
>> >> >
>> >> >
>> >> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <herold.phil@gmail.com
>> >
>> >> > wrote:
>> >> > > The implementation of this final method (latest 4.9 code) calls
>> >> > > ensureOpen(), which fails, since the reader is closed. As a result,
>> >> > > this method doesn't work. It seems as if this is therefore a
>> potential
>> >> > > memory leak,  not being able to remove the listener. Or am I
>> missing
>> >> > something?
>> >> > >
>> >> > > --
>> >> > > Phil
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
>> additional
>> >> > commands, e-mail: dev-help@lucene.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> >> For additional commands, e-mail: dev-help@lucene.apache.org
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
>

Re: IndexReader.removeReaderClosedListener

Posted by Phil Herold <ph...@nc.rr.com>.
Fine. I'm sure you've got a good reason for this. But it is totally
un-intuitive, and introduces a potential memory leak, IMO. The
implementation of this pattern is definitely different than just about any
other library I can think of.

Given that having a listener for index closed doesn't really solve the
issue I was having that I was hoping it would, it doesn't much matter to me
at this point.

Thanks.

--
Phil


On Wed, Aug 20, 2014 at 8:37 AM, Robert Muir <rc...@gmail.com> wrote:

> I don't agree. Operations like this shouldnt be performed on closed
> readers.
>
> the ensureOpen is correct.
>
> On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
> > Bingo. ensureOpen() should not be called from this method. Thanks.
> >
> > --
> > Phil
> >
> >
> >
> > On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
> >>
> >> Hi,
> >>
> >> In my opinion, removing the listener before close looks wrong. Because
> you
> >> would not get the listener events for the explicit close of the
> >> DirectoryReader.
> >>
> >> I would just remove the ensureOpen(). We should open issue.
> >>
> >> Uwe
> >> -----
> >> Uwe Schindler
> >> H.-H.-Meier-Allee 63, D-28213 Bremen
> >> http://www.thetaphi.de
> >> eMail: uwe@thetaphi.de
> >>
> >>
> >> > -----Original Message-----
> >> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
> >> > Sent: Wednesday, August 20, 2014 9:53 AM
> >> > To: Lucene/Solr dev; Phil Herold
> >> > Subject: Re: IndexReader.removeReaderClosedListener
> >> >
> >> > Hmm, you should call this method before closing the IndexReader, to
> >> > remove a listener you previously added.
> >> >
> >> > Mike McCandless
> >> >
> >> > http://blog.mikemccandless.com
> >> >
> >> >
> >> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
> >> > wrote:
> >> > > The implementation of this final method (latest 4.9 code) calls
> >> > > ensureOpen(), which fails, since the reader is closed. As a result,
> >> > > this method doesn't work. It seems as if this is therefore a
> potential
> >> > > memory leak,  not being able to remove the listener. Or am I missing
> >> > something?
> >> > >
> >> > > --
> >> > > Phil
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
> additional
> >> > commands, e-mail: dev-help@lucene.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: dev-help@lucene.apache.org
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Re: IndexReader.removeReaderClosedListener

Posted by Robert Muir <rc...@gmail.com>.
I don't agree. Operations like this shouldnt be performed on closed readers.

the ensureOpen is correct.

On Wed, Aug 20, 2014 at 8:27 AM, Phil Herold <ph...@nc.rr.com> wrote:
> Bingo. ensureOpen() should not be called from this method. Thanks.
>
> --
> Phil
>
>
>
> On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
>>
>> Hi,
>>
>> In my opinion, removing the listener before close looks wrong. Because you
>> would not get the listener events for the explicit close of the
>> DirectoryReader.
>>
>> I would just remove the ensureOpen(). We should open issue.
>>
>> Uwe
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe@thetaphi.de
>>
>>
>> > -----Original Message-----
>> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
>> > Sent: Wednesday, August 20, 2014 9:53 AM
>> > To: Lucene/Solr dev; Phil Herold
>> > Subject: Re: IndexReader.removeReaderClosedListener
>> >
>> > Hmm, you should call this method before closing the IndexReader, to
>> > remove a listener you previously added.
>> >
>> > Mike McCandless
>> >
>> > http://blog.mikemccandless.com
>> >
>> >
>> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
>> > wrote:
>> > > The implementation of this final method (latest 4.9 code) calls
>> > > ensureOpen(), which fails, since the reader is closed. As a result,
>> > > this method doesn't work. It seems as if this is therefore a potential
>> > > memory leak,  not being able to remove the listener. Or am I missing
>> > something?
>> > >
>> > > --
>> > > Phil
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
>> > commands, e-mail: dev-help@lucene.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: IndexReader.removeReaderClosedListener

Posted by Phil Herold <ph...@nc.rr.com>.
Bingo. ensureOpen() should not be called from this method. Thanks.

--
Phil


On Wed, Aug 20, 2014 at 4:55 AM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Hi,
>
> In my opinion, removing the listener before close looks wrong. Because you
> would not get the listener events for the explicit close of the
> DirectoryReader.
>
> I would just remove the ensureOpen(). We should open issue.
>
> Uwe
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: Michael McCandless [mailto:lucene@mikemccandless.com]
> > Sent: Wednesday, August 20, 2014 9:53 AM
> > To: Lucene/Solr dev; Phil Herold
> > Subject: Re: IndexReader.removeReaderClosedListener
> >
> > Hmm, you should call this method before closing the IndexReader, to
> > remove a listener you previously added.
> >
> > Mike McCandless
> >
> > http://blog.mikemccandless.com
> >
> >
> > On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
> > wrote:
> > > The implementation of this final method (latest 4.9 code) calls
> > > ensureOpen(), which fails, since the reader is closed. As a result,
> > > this method doesn't work. It seems as if this is therefore a potential
> > > memory leak,  not being able to remove the listener. Or am I missing
> > something?
> > >
> > > --
> > > Phil
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> > commands, e-mail: dev-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

RE: IndexReader.removeReaderClosedListener

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

In my opinion, removing the listener before close looks wrong. Because you would not get the listener events for the explicit close of the DirectoryReader.

I would just remove the ensureOpen(). We should open issue.

Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Michael McCandless [mailto:lucene@mikemccandless.com]
> Sent: Wednesday, August 20, 2014 9:53 AM
> To: Lucene/Solr dev; Phil Herold
> Subject: Re: IndexReader.removeReaderClosedListener
> 
> Hmm, you should call this method before closing the IndexReader, to
> remove a listener you previously added.
> 
> Mike McCandless
> 
> http://blog.mikemccandless.com
> 
> 
> On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com>
> wrote:
> > The implementation of this final method (latest 4.9 code) calls
> > ensureOpen(), which fails, since the reader is closed. As a result,
> > this method doesn't work. It seems as if this is therefore a potential
> > memory leak,  not being able to remove the listener. Or am I missing
> something?
> >
> > --
> > Phil
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: IndexReader.removeReaderClosedListener

Posted by Michael McCandless <lu...@mikemccandless.com>.
Hmm, you should call this method before closing the IndexReader, to
remove a listener you previously added.

Mike McCandless

http://blog.mikemccandless.com


On Tue, Aug 19, 2014 at 11:27 AM, Phil Herold <he...@gmail.com> wrote:
> The implementation of this final method (latest 4.9 code) calls
> ensureOpen(), which fails, since the reader is closed. As a result, this
> method doesn't work. It seems as if this is therefore a potential memory
> leak,  not being able to remove the listener. Or am I missing something?
>
> --
> Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org