On Wed, 2013-07-24 at 01:40 -0700, Hiranya Jayathilaka wrote: > Hi again, > > On Jul 24, 2013, at 1:36 AM, Hiranya Jayathilaka > <[email protected]> wrote: > > > Hi Oleg, > > > > > > I can reproduce the problem with the attached JUnit test case. This > > test case doesn't use any Axis2/Synapse related code. It only > > requires HTTP Core and HTTP client. I used HTTP Core 4.2.4 for > > testing. > > > > > > The test case starts a ListeningIOReactor, does a simple HTTP > > request-response exchange and then terminates the reactor. Then > > after a couple of seconds, it tries to start the IO reactor again > > and the exception occurs. Here's the full output: > > > > > > Round 1 > > Listener started on port: 8280 > > Connected > > Request received > > Response submitted > > Waiting - Shutdown in 5 secs > > Shutdown > > > > > > … wait 2 seconds... > > > > > > Round 2 > > Listener started on port: 8280 > > Waiting - Shutdown in 5 secs > > java.net.BindException: Address already in use > > at sun.nio.ch.Net.bind(Native Method) > > at > > sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124) > > at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) > > at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52) > > at > > org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.processSessionRequests(DefaultListeningIOReactor.java:238) > > at > > org.apache.http.impl.nio.reactor.DefaultListeningIOReactor.processEvents(DefaultListeningIOReactor.java:144) > > at > > org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:374) > > at org.apache.synapse.transport.nhttp.HttpCoreTest > > $3.run(HttpCoreTest.java:101) > > Shutdown > > > I've also noticed that the problem doesn't occur if we do not send any > messages in the 1st round. I verified this behavior with Synapse too. > If a test case doesn't send any messages to Synapse, the test case > that follows will run without any issues. >
Hiranya (1) The socket is CLOSE_WAIT state is from the client connection. It has nothing to do with the problem and can be gotten rid of by shutting down the client connection pool. client.getConnectionManager().shutdown(); (2) The 'Address already in use' problem goes away if the server is configured to re-use socket address reactorConfig.setSoReuseAddress(true); I think this option should be activated for integration tests running inside the same JVM anyway, but I'll investigate why the address remains bound even after the listener has been shut down. I am not yet sure whether this is a bug or an expected behavior. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
