question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Okhttp crashes app with SSLException: Unable to create application data

See original GitHub issue

We were testing our app by changing the date on the device when this crash happened. I’m not sure if the crash is related to the date change or not.

Here is the crash log:

java.lang.RuntimeException: javax.net.ssl.SSLException: Unable to create application data
	at com.android.org.conscrypt.ConscryptFileDescriptorSocket.newSsl(ConscryptFileDescriptorSocket.java:161)
	at com.android.org.conscrypt.ConscryptFileDescriptorSocket.<init>(ConscryptFileDescriptorSocket.java:152)
	at com.android.org.conscrypt.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:149)
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:230)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:198)
	at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:174)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
	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:109)
	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:124)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
	at okhttp3.RealCall.access$100(RealCall.java:33)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at java.lang.Thread.run(Thread.java:764)
Caused by: javax.net.ssl.SSLException: Unable to create application data
	at com.android.org.conscrypt.NativeCrypto.SSL_new(Native Method)
	at com.android.org.conscrypt.SslWrapper.newInstance(SslWrapper.java:58)
	at com.android.org.conscrypt.ConscryptFileDescriptorSocket.newSsl(ConscryptFileDescriptorSocket.java:159)
	... 27 more

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
swankjessecommented, Jan 7, 2018

There’s a bunch of problems that can be caused by resource exhaustion: can’t open files, can’t allocate memory, can’t create threads.

We should be prudent to not exhaust resources ourselves: don’t leak memory, files, or threads. Make APIs where it’s clear who is responsible for releasing which resources.

But we shouldn’t attempt to recover from resource exhaustion problems. The process has become unstable and it’s soon going to exit.

I think this is a resource exhaustion bug and that the cause is external to OkHttp and our TLS library.

0reactions
AlbertSnowcommented, Sep 4, 2020

Yes, we should not recover from exhaust resources. But if almost file descriptor is consumed by okhttp. I think there should be some strategy to avoid the case. In our app, almost file descriptor exhaust is report from OkHttp stack. I presume there is some reason why file descriptors consume, but socket not reuse. So every https connect, will cause pip creation, consume file descriptor. So crash.

Hope the presume can give some help. Thank you;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android app crash okhttp3 HTTP FAILED: javax.net.ssl ...
Android app crash okhttp3 HTTP FAILED: javax.net.ssl.SSLException: Read error: I/O error during system call, Software caused connection abort.
Read more >
3.x Change Log - OkHttp
Fix: Don't crash when running as a plugin in Android Studio Canary 4.1. To enable platform-specific TLS features OkHttp must detect whether it's...
Read more >
Ktor-client OkHttp exceptions crash Android app
I would very much like it to wrap so my app does not crash. Stacktrace: javax.net.ssl.SSLException: Read error: ssl=0x7cfb5a35c8: I/O error during system ......
Read more >
Crash on okhttp3 client after updating Android app to v6.3.1
Hi there, After updating to v6.3.1 in Android, the app crashes on okhttp3 client: LOCATION Cache.java line 233 in `okhttp3.
Read more >
How does java net SocketException Connection reset happen
The cause is the connection inside HttpClient is stale. Check stale connection for SSL does not fix this error. Solution: dump your client...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found