Maybe not the suspend call directly, but as a side effect.
If the server is not started, the correct expceiton if thrown by the client.
If the server is suspended and restarted, then the client connects correctly.

2009/2/24 Emmanuel Lecharny <elecha...@apache.org>:
> On Tue, Feb 24, 2009 at 3:45 PM, Guillaume Nodet <gno...@gmail.com> wrote:
>> This explanation is more in line with what I found.  I'm not sure
>> either why the socket connection works.  I've tried to add a sleep
>> between the suspend and connect but to no avail.
>
> I don't think that the suspend is the origin of the problem.
>
> I will do some more debugging on Mac in a few hours. seems like the
> socket.connect() hangs, but I don't know if the acceptor receives any
> incoming request.
>
> I'm wondering if there is not a big issue in the
> AbstractPollingIoAcceptor.Acceptor.run() method :
> ...
>                    // Now, if the number of registred handles is 0, we can
>                    // quit the loop: we don't have any socket listening
>                    // for incoming connection.
>                    if (nHandles == 0) {
>                        synchronized (lock) {
>                            if (registerQueue.isEmpty()
>                                    && cancelQueue.isEmpty()) {
>                                acceptor = null;
>                                break;
>                            }
>                        }
>                    }
> ...
>
> when we call the server.suspend() method. If we don't get out of the
> loop, or if the lock is handled by some other thread, we might have a
> problem. As I don't have a mac here, I can't check atm.
>
>
>>
>> 2009/2/24 Emmanuel Lecharny <elecha...@apache.org>:
>>> Ok, I have been able to go a bit further on Windows.
>>>
>>> The slector.keys().isEmpty() returns true too, so we also exit from
>>> the server acceptor loop.
>>>
>>> When the client tries to connect again, it can't and an exception is
>>> thrown (which is expected).
>>>
>>> As far as I remember, on mac, this is where the test blcok : the
>>>
>>>        try {
>>>            client.connect("localhost", port);
>>>
>>> code waits forever, when it should get out immediately with this exception :
>>>
>>>
>>> java.net.ConnectException: Connection refused: connect
>>>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>        at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>>        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>>        at java.net.PlainSocketImpl.connect(Unknown Source)
>>>        at java.net.SocksSocketImpl.connect(Unknown Source)
>>>        at java.net.Socket.connect(Unknown Source)
>>>        at org.apache.commons.net.SocketClient.connect(SocketClient.java:176)
>>>        at 
>>> org.apache.ftpserver.clienttests.SuspendResumeTest.testSuspendResumeServer(SuspendResumeTest.java:46)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>>        at junit.framework.TestCase.runTest(TestCase.java:164)
>>>        at junit.framework.TestCase.runBare(TestCase.java:130)
>>>        at junit.framework.TestResult$1.protect(TestResult.java:106)
>>>        at junit.framework.TestResult.runProtected(TestResult.java:124)
>>>        at junit.framework.TestResult.run(TestResult.java:109)
>>>        at junit.framework.TestCase.run(TestCase.java:120)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>>>        at 
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>>>
>>> For some reason, it does not ... Why ???
>>>
>>> --
>>> Regards,
>>> Cordialement,
>>> Emmanuel Lécharny
>>> www.iktek.com
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to