Hi,

On Mon, Sep 13, 2010 at 11:30 AM, Emmanuel Lécharny <elecha...@apache.org>wrote:

>
>  Hi,
>>
>> Now that 2.0. is coming so close, I tried to get a cleaner fix for the
>> MdcInjectionFilterTest that used to be failing.
>> Sorry that I didn't get to it sooner.
>>
>> The problem lies not so much in that test-case.
>> IMO, the problem is basically that since revision=900163 [1] we no longer
>> have an API to block until an AbstractIoService is completely disposed.
>> I am afraid that we have a lot of test-cases that leave threads behind,
>> when
>> finished.
>>
> The problem with the way people were using dispose was wrong : calling
> dispose() in a listener was a garante for a deadlock, as the wait was done
> in the same thread.


I agree.
But IIUC, revision 900163 tried to make it possible to call dispose from a
listener ?
That was the reason to remove the call to executor.awaitTermination, no ?



>  I have just added an overloaded dispose method :  public final void
>> dispose(boolean awaitTermination) that resurrects the previous behaviour.
>> To be safe I didn't change the default behaviour : dispose() =
>> dispose(false) = do not wait for termination.
>> Out of curiosity, I ran all tests with dispose() = dispose(true) and they
>> all passed.
>>
>
> Can you post the code you have added ?


http://svn.apache.org/viewvc?view=revision&revision=996337


>
>  I also added the attachment for DIRMINA-755 as a test-case.
>> Note that you should run the main-method instead of the test-case :
>> running
>> the test-case from my IDE (Intellij IDEA) just resulted in "All Tests
>> Passed" instead of blocking until all threads finish.
>>
> Can you attach the test in DIRMINA-755 (re-open the issue until we apply
> the patch)


Not sure what you mean ?  I already committed my changes and the test-case
in trunk :

http://svn.apache.org/viewvc/mina/trunk/mina-core/src/test/java/org/apache/mina/core/service/AbstractIoServiceTest.java?view=markup&pathrev=996337

Let me know what you think.
By the way, the hudson build failed on windows, but it works for me under
linux and Win XP.
I am afraid we have (at least one) unstable test-case.

regards
Maarten


>  The weird thing is that the behaviour is unpredictable.
>> When you run the test several times, most often the call to dispose is
>> done
>> by NioProcessor-6, but sometimes it's done by the "main" thread !?
>> (it's always run by main when  you uncomment the call to Thread.sleep)
>>
>> The following questions remain :
>> * should we support calling connector.dispose from the closeFuture
>> callback
>> ?  I don't think so.
>> * If we don't support it, should we try to detect it, and log a warning
>> about is ? I don't think so.
>>
>> Trying to detect if people are shooting themselves in the foot is not easy
>> in this case (or at least not elegant).
>>
>
> Sure !
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Reply via email to