[
https://issues.apache.org/jira/browse/CXF-7122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15644197#comment-15644197
]
William Montaz commented on CXF-7122:
-------------------------------------
It seems that with CXF 3.0.5 HttpAsyncClient 4.0.2 is used, the code is quite
the same except for one line,
@Override
protected void onRelease(final BasicNIOPoolEntry entry) {
final NHttpClientConnection conn = entry.getConnection();
entry.setSocketTimeout(conn.getSocketTimeout());
conn.setSocketTimeout(0);
}
it seems that it is that line that what was corrected in HTTPASYNC-105
(https://github.com/ok2c/httpasyncclient/commit/67f4d6e5413d8c6ed6879dc351a81925e4398eeb)
BUT in HTTPASYNC-105 they mention that the second request does not use any
timeout in requestconfig. In CXF, we do specify requestconfig, so it should
also be safe on versions 3.0.x !
Have you also been able to reproduce the tests that fail (the ones where
request is not actually timedout at the socket level) ?
I'm looking forward to your responses
William
> Infinite loop due to AsyncHTTPConduit read timeout with exhausted connection
> pool
> ---------------------------------------------------------------------------------
>
> Key: CXF-7122
> URL: https://issues.apache.org/jira/browse/CXF-7122
> Project: CXF
> Issue Type: Bug
> Components: Transports
> Reporter: William Montaz
> Assignee: Freeman Fang
> Priority: Critical
> Fix For: 3.2.0, 3.1.9
>
> Attachments: AsyncHTTPConduitTest.java
>
>
> Using AsyncHTTPConduit, when the underlying connection pool gets exhausted,
> requests waiting for a connection will lead to an infinite loop if they reach
> receive timeout.
> The problem occured on all versions of CXF above 3.0.5 (we did not tested
> other ones).
> Let's imagine a backend that's broken and leads to timeout for all requests.
> When handling requests, the cxf worker thread will eventually go in wait
> state (AsyncHTTPConduit:618), with a timeout that matches the
> HTTPClientPolicy.setReceiveTimeout() value, waiting for the NIO stack to
> complete and call notifyAll via responseCallback (AsyncHTTPConduit:455).
> The timeout on the wait is the big problem :
> With our broken backend, the connection pool is exhausted waiting for other
> requests to timeout. When a new request is made by cxf against this backend,
> after timeout time this will happen :
> - on the one side the reactor threads will get a connection from the pool
> and try to write to the output stream. Waiting in the pool is not considered
> as receive timeout.
> - on the other side the cxf worker thread will wake up (because of the
> timedout wait), and shutdown SharedOutputBuffer and SharedInputBuffer
> (AsyncHTTPClient:624)
> - reactor threads will go to infinite loop because they will try to
> produceContent from a shutdown buffer (SharedOutputBuffer:120)
>
> From there, application recovery is compromised.
>
> To fix that, timeout should be handled only via the client callback
> (AsyncHTTPConduit:463).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)