6

NullPointerException: bio == null

 3 years ago
source link: https://publicobject.com/2021/01/30/bio-null/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

NullPointerException: bio == null

Published on 2021-01-30

Sometimes multiple threads close the same Socket concurrently. Unfortunately, Android 10 and 11 may crash when this happens:

java.lang.NullPointerException: bio == null
  at com.android.org.conscrypt.NativeCrypto.SSL_pending_written_bytes_in_BIO()
  at com.android.org.conscrypt.NativeSsl$BioWrapper.getPendingWrittenBytes()
  at com.android.org.conscrypt.ConscryptEngine.pendingOutboundEncryptedBytes()
  at com.android.org.conscrypt.ConscryptEngineSocket.drainOutgoingQueue()
  at com.android.org.conscrypt.ConscryptEngineSocket.close()
  at okhttp3.internal.Util.closeQuietly()
  at okhttp3.internal.connection.ExchangeFinder.findConnection()
  ...
123456789

Fortunately, it’s easy and safe for OkHttp to work around this problem. We just released OkHttp 3.12.13 and OkHttp 4.9.1 to do just that.

If you’re shipping Android apps, please upgrade!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK