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

grpc-java is not compatible with native-image with Quarkus wich enable the --link-at-build-time option. #10781

Closed
SetoKaiba opened this issue Dec 24, 2023 · 4 comments

Comments

@SetoKaiba
Copy link

SetoKaiba commented Dec 24, 2023

What version of gRPC-Java are you using?

1.59.0

What is your environment?

Ubuntu WSL
GraalVM 21.0.1

What did you expect to see?

I want to use google cloud client library vertex ai project which has a dependcy to grpc-java.
https://github.com/googleapis/google-cloud-java/tree/main/java-vertexai
grpc-java should be compatible with native-image with Quarkus wich enable the --link-at-build-time option.

What did you see instead?

grpc-java is not compatible with native-image with Quarkus wich enable the --link-at-build-time option.
Please check the reproduce project in the section Steps to reproduce the bug.

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.grpc.alts.GoogleDefaultChannelCredentials$Builder.callCredentials(io.grpc.CallCredentials).

This error is reported at image build time because class com.google.api.gax.grpc.InstantiatingGrpcChannelProvider is registered for linking at image build time by command line and command line.

  • After I apply the commit above, I will see the problem below.

Caused by: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.debug.GraalError: com.oracle.svm.core.util.UserError$UserException: Class initialization of io.grpc.xds.internal.security.SslContextProvider failed

This error is reported at image build time because class io.grpc.xds.internal.security.SslContextProvider is registered for linking at image build time by command line and command line. Use the option

  • The problem
    • grpc-java is compatible without --link-at-build-time option.
    • Quarkus enable --link-at-build-time option.
    • Quarkus has to use grpc-netty instead of the grpc-netty-shaded which has a lot of problem in Quarkus. But grpc-xds has a depency to grpc-netty-shaded.

Steps to reproduce the bug

https://github.com/SetoKaiba/gcp_reproduce
Use the reproduce project to reproduce.

Related issues

quarkusio/quarkus#37909
googleapis/google-cloud-java#10180
#9736

@sergiitk
Copy link
Member

sergiitk commented Jan 2, 2024

This looks like a duplicate of #9736. Since there's a demand for it, we'll revisit this issue at a team meeting next week.

@ejona86
Copy link
Member

ejona86 commented Jan 9, 2024

There's multiple Gax things listed, which aren't really relevant to gRPC. The gRPC issue appears to be io.grpc.xds.internal.security.SslContextProvider. But that error message isn't entirely helpful as it doesn't say what is wrong with SslContextProvider.

I will say that we don't really support Quarkus directly; we have no expertise with it. All fixes up to this point have been community contributions, although the googleapis folks may be able to help us as they have more experience.

googleapis/google-cloud-java#10180 (comment) provides a lot of good details of what is going on. That does get us back to io.netty.util.internal.logging.Log4J2Logger of #9736, which is really a Netty issue or a "the config rewriting in #8258 doesn't work properly" issue. But I don't think we have expertise to distinguish between them.

Use the reproduce project to reproduce.

What should I do to see that error?

My attempt to reproduce, which ran without errors:

docker run --rm -it docker.io/library/debian:11
cd
apt update
apt install -y git
# download https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz
tar xvzpf graalvm-jdk-21_linux-x64_bin.tar.gz
export PATH=$PATH:$PWD/graalvm-jdk-21.0.1+12.1/bin/
git clone https://github.com/SetoKaiba/gcp_reproduce.git
cd gcp_reproduce
chmod +x gradlew
./gradlew build

@SetoKaiba
Copy link
Author

SetoKaiba commented Jan 10, 2024

There's multiple Gax things listed, which aren't really relevant to gRPC. The gRPC issue appears to be io.grpc.xds.internal.security.SslContextProvider. But that error message isn't entirely helpful as it doesn't say what is wrong with SslContextProvider.

I will say that we don't really support Quarkus directly; we have no expertise with it. All fixes up to this point have been community contributions, although the googleapis folks may be able to help us as they have more experience.

googleapis/google-cloud-java#10180 (comment) provides a lot of good details of what is going on. That does get us back to io.netty.util.internal.logging.Log4J2Logger of #9736, which is really a Netty issue or a "the config rewriting in #8258 doesn't work properly" issue. But I don't think we have expertise to distinguish between them.

Use the reproduce project to reproduce.

What should I do to see that error?

My attempt to reproduce, which ran without errors:

docker run --rm -it docker.io/library/debian:11
cd
apt update
apt install -y git
# download https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz
tar xvzpf graalvm-jdk-21_linux-x64_bin.tar.gz
export PATH=$PATH:$PWD/graalvm-jdk-21.0.1+12.1/bin/
git clone https://github.com/SetoKaiba/gcp_reproduce.git
cd gcp_reproduce
chmod +x gradlew
./gradlew build

@ejona86 Build the native image for it.

./gradlew build -Dquarkus.package.type=native

@ejona86
Copy link
Member

ejona86 commented Jan 11, 2024

Let's close this as a duplicate of #10601. There's some details there about what seems to be going on.

@ejona86 ejona86 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants