Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.7.5
-
None
-
Unknown
Description
When using AsyncHttpConduit with a certificate alias CXF hangs after a bunch of requests.
Root cause:
For each request, when AsyncHTTPConduit.getSSLContext() is called, the KeyManagers are wrapped by an AliasedX509ExtendedKeyManager. After some time, the KeyManagers are wrapped thousands of times. Then, at the moment a new connection needs to be established, a StackOverflowError is thrown when AliasedX509ExtendedKeyManager.getPrivateKey() is called. This causes the I/O dispatchers of the HttpAsynClient to all go down one after the other. When all the I/O dispatchers are down all requests done on the HttpAsyncClient are timing out.
In AsyncHTTPConduit.getSSLContext() the hash code of the TlsClientParameters is checked to decide whether or not a new SSLContext should be created. This is not working in this context as the wrapping of the KeyManagers has an influence on the tlsClientParameters hash code.
Additionally (not directly linked to the issue), the hash code should never be used as an identifier. Two different TlsClientParameters might have the same hash code, in such a case the cached SSLContext won't be refreshed.
Other points:
- The AsyncHTTPConduit is containing a few auto generated catch blocks (with e.printStackTrace(); ).
- When the I/O dispatchers are going down (quite an important issue), the error is logged on the System.err and nothing is logged on the Logger.
- In the CXF documentation nothing is mentioned on the fact the HttpAsyncClient is still in beta.