PUBLIC OBJECT

NullPointerException: bio == null

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()
  ...

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!