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

Crash due to use of getAlpnSelectedProtocol on Android 11 #7519

Closed
eleventigerssc opened this issue Oct 13, 2020 · 1 comment
Closed

Crash due to use of getAlpnSelectedProtocol on Android 11 #7519

eleventigerssc opened this issue Oct 13, 2020 · 1 comment

Comments

@eleventigerssc
Copy link

What version of gRPC-Java are you using?

1.25.0

What is your environment?

Android 11, target API level 30.

What did you expect to see?

Possibility to use grpc-java in apps targeting API 30 on Android 11 devices.

What did you see instead?

E  java.lang.AssertionError: Method getAlpnSelectedProtocol not supported for object SSL socket over Socket[address=redacted,port=443,localPort=40924]
E      at io.grpc.okhttp.internal.OptionalMethod.invoke(OptionalMethod.java:114)
E      at io.grpc.okhttp.internal.OptionalMethod.invokeWithoutCheckedException(OptionalMethod.java:135)
E      at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.getSelectedProtocol(OkHttpProtocolNegotiator.java:183)
E      at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:145)
E      at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:63)
E      at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:568)
E      at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E      at java.lang.Thread.run(Thread.java:923)

Steps to reproduce the bug

Use io.grpc:grpc-okhttp:1.25 transport and issue a gRPC request in an app compiled to target API 30 on Android 11. This happens due to outdated OkHttp while it seems the graylisted getAlpnSelectedProtocol method issue was fixed in https://square.github.io/okhttp/changelog_3x/#version-3147 (more info in: square/okhttp#3980). It is not possible to force grpc-okhttp to use 3x OkHttp as there are breaking changes, it also seems that the #6119 has stalled.

I am not sure if there is any workaround to this?

@eleventigerssc
Copy link
Author

This seems to be fixed by 5803dfd, upgrading to 1.32.2 has solved the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant