[ 
https://issues.apache.org/jira/browse/LUCENE-6335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14348356#comment-14348356
 ] 

Dawid Weiss commented on LUCENE-6335:
-------------------------------------

I reviewed the test rule. It looks crazily bound to the default JDK 
implementation (all that reflection) but there seems to be no other way to get 
hold of the thread locals map, so be it.

Overall it looks good. I'm slightly concerned with this:
{code}
+    ClassLoader cl = clazz.getClassLoader();
+    // our crazy heuristic: threadlocal contains something from non-bootstrap 
loader.
+    if (cl != null) {
+      throw new ThreadLocalLeakException(getPrettyClassName(clazz));
+    }
{code}
because I planned to isolate the test runner's classes from the test classes at 
some point by forking a separate classloader... But there are workarounds for 
this and these can be applied and explored when the actual problem shows up.

+1

> fail tests on threadlocal leaks
> -------------------------------
>
>                 Key: LUCENE-6335
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6335
>             Project: Lucene - Core
>          Issue Type: Test
>            Reporter: Robert Muir
>         Attachments: LUCENE-6335.patch, LUCENE-6335.patch, LUCENE-6335.patch
>
>
> I know this requires us to do things like close our Analyzers in tests, but I 
> think we should do it. just experimenting i found other leaks, e.g. in 
> LineFileDocs.
> {noformat}
>    [junit4] ERROR   0.00s J0 | TestForceMergeForever (suite) <<<
>    [junit4]    > Throwable #1: java.lang.IllegalStateException: ThreadLocal 
> leaks were found: 
>    [junit4]    > 1. 
> thread=SUITE-TestForceMergeForever-seed#[AF7141C55A57350E]-worker 
> value=WeakReference<HashMap<?,Analyzer$TokenStreamComponents>>
>    [junit4]    > 2. 
> thread=SUITE-TestForceMergeForever-seed#[AF7141C55A57350E]-worker 
> value=LineFileDocs$DocState
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to