* SSL session caching/reusing disabled to prevent memory corruption #785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
making multiple request to same host/port cause some of them terminated with message
(or application crashed random places)
root case
Reusing same Session cause same native SSL_Session to be used with each opened OpenSSLSocketImpl. It associates it's native pointer with its SSL.
As result multiple OpenSSLSocketImpl and its SSL will use same single session. Problem appear once this socked is being closed, as it destroys SSL by calling
NativeCrypto.SSL_free(sslNativePointer);
and SSL under hood destroys all elements it contains, and shared session as result.This cause single object to be multiple times released, released memory is used as valid -- this causes logic errors as described above and SIGABRT crashes.
The "fix"
Properly fixing session sharing on Android 4.4.x code base is problematic as things are not implemented this way. In recent version of Libcore its handled completely different way. The way to prevent apps from crashing is to disable the feature. it will introduce longer TLS handshake.
RoboVMx experimental port is not affected by this issue.