On Mon, 2012-11-12 at 12:10 -0500, Sachin Nikumbh wrote:
> Hi,
> 
> I am trying out the HTTP async client and have some sporadic behavior when
> it comes to HTTP response 413. The server I am communicating with has a
> request size limit. When my request content exceeds this limit, the server
> sends response 413 and closes the connection. Following is the snippet of
> my code that's using DefaultHttpAsyncClient:
> 
> ***********************************************************************************************
> HttpAsyncClient httpClientAsync = new DefaultHttpAsyncClient();
> httpClientAsync.start();
> final HttpPost postReq = new HttpPost(mpsUrl);
> postReq.setEntity( new ByteArrayEntity(mlParams.toByteArray()) );
> final HttpResponse response = future.get();
> final int respCode = response.getStatusLine().getStatusCode();
> ***********************************************************************************************
> 
> I do get the respCode of 413 sometimes, But for almost 50% of executions,
> the future.get() call results in following exception:
> 
> ***********************************************************************************************
> Nov 12, 2012 11:59:06 AM
> org.apache.http.impl.nio.client.LoggingAsyncRequestExecutor exception
> SEVERE: http-outgoing-1 [ACTIVE] HTTP protocol exception: An established
> connection was aborted by the software in your host machine
> java.io.IOException: An established connection was aborted by the software
> in your host machine

Sachin

I do not think this problem has anything to do with HttpAsyncClient. The
connection gets reset at the OS / network level.

Oleg


> at sun.nio.ch.SocketDispatcher.read0(Native Method)
> at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
> at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)
> at sun.nio.ch.IOUtil.read(IOUtil.java:171)
> at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:243)
> at
> org.apache.http.impl.nio.reactor.SessionInputBufferImpl.fill(SessionInputBufferImpl.java:97)
> at
> org.apache.http.impl.nio.codecs.AbstractMessageParser.fillBuffer(AbstractMessageParser.java:115)
> at
> org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:167)
> at
> org.apache.http.impl.nio.DefaultHttpClientIODispatch.onInputReady(DefaultHttpClientIODispatch.java:125)
> at
> org.apache.http.impl.nio.DefaultHttpClientIODispatch.onInputReady(DefaultHttpClientIODispatch.java:49)
> at
> org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:112)
> at
> org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:160)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:342)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:320)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280)
> at
> org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
> at
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:604)
> at java.lang.Thread.run(Thread.java:662)
> ***********************************************************************************************
> 
> Is there anything I can do to reliably receive the 413 response case?
> 
> Thanks
> Sachin



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

Reply via email to