[ 
https://issues.apache.org/jira/browse/SYNAPSE-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jake Lambert updated SYNAPSE-344:
---------------------------------

    Description: 
When using a proxy service and HTTP-NIO with a moderate number of concurrent 
requests some requests fail with the following error:

HttpServerWorker-25: Unexpected HTTP protocol error: Request already submitted
org.apache.http.HttpException: Request already submitted
        at 
org.apache.http.impl.nio.DefaultNHttpClientConnection.submitRequest(DefaultNHttpClientConnection.java:203)
        at 
org.apache.synapse.transport.nhttp.ClientHandler.submitRequest(ClientHandler.java:142)
        at 
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:340)
        at 
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
        ...

This can occur in a situation similar to that in SYNAPSE-341 (remote WS returns 
its response before the request is fully written).  It's due to a race 
condition when reusing a connection between a client I/O dispatcher thread 
calling NHttpClientConnection.resetOutput() when the request writing is 
complete and an HttpServerWorker thread calling 
NHttpClientConnection.submitRequest() on the same pooled connection after it 
has been released when the response reading is complete.

  was:
When using a proxy service and HTTP-NIO with a moderate number of concurrent 
requests some requests fail with the following error:

HttpServerWorker-25: Unexpected HTTP protocol error: Request already submitted
org.apache.http.HttpException: Request already submitted
        at 
org.apache.http.impl.nio.DefaultNHttpClientConnection.submitRequest(DefaultNHttpClientConnection.java:203)
        at 
org.apache.synapse.transport.nhttp.ClientHandler.submitRequest(ClientHandler.java:142)
        at 
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:340)
        at 
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
        at 
com.alcatel.grizzly.mw.transport.WSGHttpTransportSender.invoke(WSGHttpTransportSender.java:171)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
        at 
org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190)
        at 
org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174)
        at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
        at 
com.alcatel.grizzly.synapse.custom.WsgFlexibleMEPClient.send(WsgFlexibleMEPClient.java:284)
        at 
com.alcatel.grizzly.synapse.custom.WsgSynapseEnvironment.send(WsgSynapseEnvironment.java:34)
        at 
org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:195)
        at 
com.alcatel.grizzly.synapse.custom.WsgAddressEndpoint.send(WsgAddressEndpoint.java:68)
        at 
org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:157)
        at 
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:58)
        at 
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:125)
        at 
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:158)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
        at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
        at 
org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:238)
        at 
org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:194)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

This can occur in a situation similar to that in SYNAPSE-341 (remote WS returns 
its response before the request is fully written).  It's due to a race 
condition when reusing a connection between a client I/O dispatcher thread 
calling NHttpClientConnection.resetOutput() when the request writing is 
complete and an HttpServerWorker thread calling 
NHttpClientConnection.submitRequest() on the same pooled connection after it 
has been released when the response reading is complete.


> Race condition on connection reuse causes 'Request already submitted' 
> exception
> -------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-344
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-344
>             Project: Synapse
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 1.1.1
>         Environment: All environments
>            Reporter: Jake Lambert
>            Priority: Critical
>
> When using a proxy service and HTTP-NIO with a moderate number of concurrent 
> requests some requests fail with the following error:
> HttpServerWorker-25: Unexpected HTTP protocol error: Request already submitted
> org.apache.http.HttpException: Request already submitted
>       at 
> org.apache.http.impl.nio.DefaultNHttpClientConnection.submitRequest(DefaultNHttpClientConnection.java:203)
>       at 
> org.apache.synapse.transport.nhttp.ClientHandler.submitRequest(ClientHandler.java:142)
>       at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:340)
>       at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
>         ...
> This can occur in a situation similar to that in SYNAPSE-341 (remote WS 
> returns its response before the request is fully written).  It's due to a 
> race condition when reusing a connection between a client I/O dispatcher 
> thread calling NHttpClientConnection.resetOutput() when the request writing 
> is complete and an HttpServerWorker thread calling 
> NHttpClientConnection.submitRequest() on the same pooled connection after it 
> has been released when the response reading is complete.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to