directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <m...@stefan-seelmann.de>
Subject Re: Weird behavior in Server-integ tests
Date Fri, 02 Aug 2013 17:35:01 GMT
On 08/02/2013 10:02 AM, Emmanuel Lécharny wrote:
> Le 8/2/13 9:20 AM, Emmanuel Lécharny a écrit :
>> Hi guys,
>>
>> there is something that is extremelly weird i server-integ test : we
>> have some kind of 1 second delay for each test we run. For instance,
>> when we run the SearchIT tests, any test is taking 1 second at least to
>> execute.
>>
>> This should not be the case, because we don't inject a lot of entries.
>>
>> I suspect that MINA is the culprit here : the select() loop is waiting 1
>> second before acting.
>>
>> This slows down the tests a lot, as we have around 600 of them.
>>
>> To be investigated...
>>
> After investigation, I found that the following line :
> 
> public class SearchIT extends AbstractLdapTestUnit
> {
>     @Rule
>     public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker(
> MultiThreadedMultiInvoker.NOT_THREADSAFE );
> 
> cause the delay.
> 
> With this line, the SearchIT test runs in rouglhy 49 seconds, withhout
> it, it runs in 13 seconds !
> 
> The reason is that the MultiThreadMultiInvoker introduce a 1 second sleep :
> 
>                 while(counter.get() > 0)
>                 {
>                     Thread.sleep( 1000 );
>                 }
> (line 187).

Well, I must admit that the implementation of that class is not very
smart, it uses runnables that count down a counter when they are done.
When using Futures instead the counter and the sleep can be avoided.
I'll try up fix that.

> We shoumd probably get rid of this @rules, unless we have very good
> reason to use it...

Yes do so. They are helpful to find concurrency issues by running tests
multiple times in parallel.

Kind Regards,
Stefan


Mime
View raw message