Hi there!
First at all thank you very much for your library!
I've integrated okhttp3 since couple months ago; there were no problem until yesterday with an user (Huawei, model MHA-L29, on Android 7.0):
Fatal Exception: java.lang.IllegalArgumentException: Unexpected TLS version: NONE
at okhttp3.TlsVersion.forJavaName(TlsVersion.java:53)
at okhttp3.Handshake.get(Handshake.java:56)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:300)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)
Have you got some ideas about this crash?
Thank you very much guys!
Does your app change the SSL provider in any way? to GMS services e.g. include ProviderInstaller.installIfNeeded. It could also just be the setup of that phone.
Is it a one-off or consistently reproducible?
I've seen a similar issue in rare timing cases either before or after a network issue, a non-standard SSL provider can return NONE as the string. OkHttp might have to handle this more gracefully.
Hi!
About your questions:
Is there a manner to catch this exception in my App to avoid a crash?
I could confirm this issue on multiple devices. You could look in details at Crashlytics http://crashes.to/s/188322d298a
Here is part of my application from stacktrace https://gist.github.com/anonymous/eb4c8d96de290e84c3e5be093060023f
I use GMS ProviderInstaller and custom SSLSocketFactory.
+1:

n.b. my PR fix will turn these into IOExceptions and handle them cleanly e.g. retry other connection routes. But it won't fix an underlying fatal problem e.g. connecting to specific servers with a custom SSLSocketFactory.
@yschimke: this crash stills there :( I've added ProviderInstaller.installIfNeeded into my App + a custom SSLSocketFactory. It's really rare, but today 1 user had this crash (Android 7.0 on Galaxy S7 Edge).
@anthony3444 the fix is in the next release (3.10), until then when they happen you will get a crash from OkHttp.
We're observing the same crash. 100% of crashes happen to users on Google phones running Android 8.1.0, though we can't reproduce on the same device we have.
@yschimke do we have an ETA of this release?
I don't, I think we had planned for a 3.10 earlier than this. cc @swankjesse @JakeWharton
Hey guys, same crash - it's quite rare for us too, was just wondering if the issue could be kept open until 3.10 is released.
Are there any extra informations that I could provide that may be needed/helpful?
I think this is fixed in 3.10.
@swankjesse is 3.10 expected to be released any time soon? thanks!
@anna-b if you look at the milestone they seem to be aiming for end Feb. So a bit more than a week.
same error using 3.10 with Retrofit 2
Fatal Exception: java.lang.IllegalArgumentException: Unexpected TLS version:
at okhttp3.TlsVersion.forJavaName(TlsVersion.java:53)
at okhttp3.TlsVersion.forJavaNames(TlsVersion.java:59)
at okhttp3.ConnectionSpec.tlsVersions(ConnectionSpec.java:113)
at okhttp3.ConnectionSpec.toString(ConnectionSpec.java:221)
at java.lang.String.valueOf(String.java:2683)
at java.lang.StringBuilder.append(StringBuilder.java:129)
at java.util.AbstractCollection.toString(AbstractCollection.java:458)
at java.util.Collections$UnmodifiableCollection.toString(Collections.java:1108)
at java.lang.String.valueOf(String.java:2683)
at java.lang.StringBuilder.append(StringBuilder.java:129)
at okhttp3.internal.connection.ConnectionSpecSelector.configureSecureSocket(ConnectionSpecSelector.java:70)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:274)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at com.justdo.logic.network.RestClient$1.intercept(RestClient.java:60)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Mostly fixed in 3.10, but there was a race condition. Hopefully fixed correctly in 3.11
Also, that stack trace appears to be 3.8.
Is this fixed in 3.11?
Yes, if you see it with 3.11 or it manifests in other similar ways, please open an issue.
@dave-r12 ve
How do you judge that the issue opened by @vasiledoe happened when using okhttp 3.8 or do I misunderstanding something?
@yschimke
Thanks for your reply.
Could you specify which commit in 3.11 fix that issue?
I just upgrade to 3.10 to fix another crash (https://github.com/square/okhttp/issues/3438)
Could you explain more about under which rare condition does this crash still happen in 3.10 ?
@gongzelong0718 please give 3.11 a try. The commits in the release are on our git history.
@gongzelong0718 the stack trace includes class names and line numbers. We can correlate that information with git tags to understand possible versions. For example: okhttp3.ConnectionSpec.tlsVersions(ConnectionSpec.java:113) at
In version 3.8 it contains this line of code:
https://github.com/square/okhttp/blob/parent-3.8.0/okhttp/src/main/java/okhttp3/ConnectionSpec.java#L113
And in 3.10:
https://github.com/square/okhttp/blob/parent-3.10.0/okhttp/src/main/java/okhttp3/ConnectionSpec.java#L113
Note that 3.10 has no executable code!
this issue still exists in okhttp3.12.1.
here is my logs:

Most helpful comment
Also, that stack trace appears to be 3.8.