Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OkHttp Websocket connection failing few seconds after getting connected #1198

Open
jashwin-codes opened this issue Mar 15, 2024 · 2 comments

Comments

@jashwin-codes
Copy link

jashwin-codes commented Mar 15, 2024

Websocket connection is failing randomly in few android devices (Eg Xiaomi POCO X2) with the below error, it is happening few seconds after handshake is succeded.

javax.net.ssl.SSLProtocolException: Read error: ssl=0xb400006f72a510c8: Failure in SSL library, usually a protocol error
error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT (third_party/openssl/boringssl/src/crypto/fipsmodule/cipher/e_aes.c:1065 0x7009c44bee:0x00000000)
error:1000008b:SSL routines:OPENSSL_internal:DECRYPTION_FAILED_OR_BAD_RECORD_MAC (third_party/openssl/boringssl/src/ssl/tls_record.cc:294 0x7009c44bee:0x00000000)
	at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_read(:com.google.android.gms@240812031@24.08.12 (150400-608507424):-2)
	at com.google.android.gms.org.conscrypt.NativeSsl.read(:com.google.android.gms@240812031@24.08.12 (150400-608507424):34)
	at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(:com.google.android.gms@240812031@24.08.12 (150400-608507424):11)
	at okhttp3.internal.ws.MessageDeflaterKt.read(MessageDeflaterKt.java:102)
	at okhttp3.internal.ws.MessageDeflaterKt.read(MessageDeflaterKt.java:23)
	at aq.z.r(z.java:31)
	at aq.z.X(z.java:0)
	at aq.z.readByte(z.java:3)
	at zp.j.c(j.java:22)
	at zp.g.f(g.java:252)
	at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$1.onResponse(HttpClientEngine.java:455)
	at rp.g.run(g.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

okHttpVersion - okhttp:4.9.3

@Xavron
Copy link

Xavron commented Aug 27, 2024

https://github.com/google/boringssl/blob/80eb8141a245293e2b133c49d5bc81316317d877/ssl/tls_record.cc#L294

The error is thrown where there is authentication of bytes.

^ DECRYPTION_FAILED_OR_BAD_RECORD_MAC. Its not just a Conscrypt or BoringSSL thing but OpenSSL can also see that error despite difference code.

Are you sure that there's no network or network hardware stability issue of some sort? Antivirus or firewall issue? There are people who see this error from that.

Because of that, there's a heavy external influence to this error. And one that can appear random like.

@prbprbprb
Copy link
Collaborator

Agreed. For this to happen mid-connection is most likely to be some kind of data corruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants