lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sami Siren <ssi...@gmail.com>
Subject Re: Thread "leaking" in junit tests
Date Fri, 29 Jun 2012 08:56:56 GMT
Thanks for the detailed explanation Dawid!

--
 Sami Siren


On Fri, Jun 29, 2012 at 11:14 AM, Dawid Weiss
<dawid.weiss@cs.put.poznan.pl> wrote:
>> WARNING: test class left thread running:
>> Thread[MultiThreadedHttpConnectionManager cleanup,5,main]
>>
>> I do not see such warnings in 4.x or trunk, how do I enable such warnings there?
>
> Open LuceneTestCase and change this attribute to true:
>
> @ThreadLeaks(failTestIfLeaking = false)
>
> this will effectively kill those leaked threads and fail the test that
> leaked them. Unfortunately the scenarios here are complex because
> threads are started within a test scope and belong to suite scope (are
> reused by all threads in a suite). Previously, the warnings were
> detected for the suite scope only which would correspond to:
>
> @ThreadLeaks(failTestIfLeaking = true, leakedThreadsBelongToSuite =
> true, linger = 1000)
>
> meaning:
>
> - fail a suite if threads leaked from it,
> - if a thread leak occurs within a test, promote it to the suite scope,
> - linger 1000 milliseconds before deciding a thread has leaked (this
> is required for thread pools and such because they never wait for
> their children threads to actually complete).
>
> Many Solr and a few Lucene tests currently leak threads so the flag is
> off. There is an issue to improve reporting of this (and handling of
> this) here:
>
> https://issues.apache.org/jira/browse/LUCENE-3985
>
> I just didn't get to it yet. Or rather: I did, but it requires changes
> to the runner -- see here:
> https://github.com/carrotsearch/randomizedtesting/issues/98
>
> Dawid
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message