My pleasure. Dealing with leaked threads is a tough area and it needs
to be addressed at some point sooner or later. The warnings are not
enough because nobody looks at them (for example in jenkins runs).
Tests (suites) simply shouldn't leak threads, period (yes, it is my
idee fixe to have this done ;).

Dawid

On Fri, Jun 29, 2012 at 10:56 AM, Sami Siren <[email protected]> wrote:
> Thanks for the detailed explanation Dawid!
>
> --
>  Sami Siren
>
>
> On Fri, Jun 29, 2012 at 11:14 AM, Dawid Weiss
> <[email protected]> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

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

Reply via email to