Hi,
We are using cxf version 2.7.12 and are using Asynchronous Client HTTP Transport to send a request to an external service. This external service runs on an Apache server and is configured as follows:-
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
i.e. the external server will close the connection after 2 seconds of idle time.
Under heavy load, every so often we see an attempt to send a request on a connection fail because at the exact same time, the external server has closed the connection. I would then expect CXF to retry the sending of the request again but it doesn't, the call just fails. Here is some relevant debug to indicate the issue:
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> POST /Service/ws/ Controls/1.0/GetStuff HTTP/1.1]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> txId: 1234]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> User-Agent: Apache CXF 2.7.12]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> SOAPAction: executeService]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Accept: */*]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Content-Length: 1547]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Content-Type: application/xml]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Host: a-b.x.com:80]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:w]: Event set [w]]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:rw]: -1 bytes read]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory$4 [txId=|client=|entryService=|callingService=] [] [[exchange: 9268] aborting connection [id:268][route:{}->http://a-b.x.com:80][state:null]]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:rw]: Shutdown]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 0.0.0.0:11111<->yyy.y.yyy.yy:yy[CLOSED][]: Shutdown]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory$3 [txId=|client=|entryService=|callingService=] [] [Connection released: [id: 268][route: {}->http://a-b.x.com:80][total kept alive: 0; route allocated: 1 of 1000; total allocated: 1 of 5000]
The only thing I've noticed which could be relevant is that when we send a request to the external service, CXF doesn't explicitly send the Keep-alive headers (as it is implicit through the use of HTTP 1.1) which means the external service does not send back the explicit Keep-Alive: timeout=2, max=100 header.
Please could someone confirm whether or not you would expect the async transport to retry sending the request when a connection is closed due to a keep-alive idle timeout? Am I missing some configuration to allow this?
Many thanks
Mandy
Sent from a mobile device
We are using cxf version 2.7.12 and are using Asynchronous Client HTTP Transport to send a request to an external service. This external service runs on an Apache server and is configured as follows:-
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
i.e. the external server will close the connection after 2 seconds of idle time.
Under heavy load, every so often we see an attempt to send a request on a connection fail because at the exact same time, the external server has closed the connection. I would then expect CXF to retry the sending of the request again but it doesn't, the call just fails. Here is some relevant debug to indicate the issue:
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> POST /Service/ws/ Controls/1.0/GetStuff HTTP/1.1]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> txId: 1234]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> User-Agent: Apache CXF 2.7.12]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> SOAPAction: executeService]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Accept: */*]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Content-Length: 1547]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Content-Type: application/xml]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.headers [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 >> Host: a-b.x.com:80]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:w]: Event set [w]]
2014-12-09 16:10:29,090 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:rw]: -1 bytes read]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory$4 [txId=|client=|entryService=|callingService=] [] [[exchange: 9268] aborting connection [id:268][route:{}->http://a-b.x.com:80][state:null]]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268xxx.x.xx.xx:xxxxx<->yyy.y.yyy.yy:yy[ACTIVE][rw:rw]: Shutdown]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.reactor.IOSessionImpl [txId=|client=|entryService=|callingService=] [] [http-outgoing-268 0.0.0.0:11111<->yyy.y.yyy.yy:yy[CLOSED][]: Shutdown]
2014-12-09 16:10:29,091 [I/O dispatcher 2] DEBUG org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory$3 [txId=|client=|entryService=|callingService=] [] [Connection released: [id: 268][route: {}->http://a-b.x.com:80][total kept alive: 0; route allocated: 1 of 1000; total allocated: 1 of 5000]
The only thing I've noticed which could be relevant is that when we send a request to the external service, CXF doesn't explicitly send the Keep-alive headers (as it is implicit through the use of HTTP 1.1) which means the external service does not send back the explicit Keep-Alive: timeout=2, max=100 header.
Please could someone confirm whether or not you would expect the async transport to retry sending the request when a connection is closed due to a keep-alive idle timeout? Am I missing some configuration to allow this?
Many thanks
Mandy
Sent from a mobile device