lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: ThreadLocal leak (was Re: Leaking org.apache.lucene.index.* objects)
Date Tue, 19 Dec 2006 19:41:26 GMT
On 12/19/06, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> I _think_ Robert is right and ThreadLocals are not the problem (I tried getting rid of
them, and replacing them with an instance var last week, but run into problems with multi-threaded
unit tests).

If you want to try getting rid of the ThreadLocals, you can't replace
with instance vars because the stuff put into the Threadlocals isn't
thread safe.
Replace the ThreadLocal stuff with the code that populated it in the
first place.

So for instance, in TermInfosReader, replace this
  private SegmentTermEnum getEnum() {
    SegmentTermEnum termEnum = (SegmentTermEnum)enumerators.get();
    if (termEnum == null) {
      termEnum = terms();
      enumerators.set(termEnum);
    }
    return termEnum;
  }

With this:
  private SegmentTermEnum getEnum() {
     return terms()
  }


> What I'm seeing while profiling (and in production) is the accumulation of these:
>
> org.apache.lucene.search.FieldCacheImpl$Entry
> org.apache.lucene.search.FieldCacheImpl$CreationPlaceholder
>
> This is related to http://issues.apache.org/jira/browse/LUCENE-651 (the commit for that
patch also happens to coincide with when I started seeing the leak).

I'll take a look into that.  Solr hasn't sync'd to that version of
Lucene yet, so we haven't seen this problem of course :-)

-Yonik

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


Mime
View raw message