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

[Question] GraalVM native support #105

Open
jefffang123 opened this issue Jan 28, 2025 · 1 comment
Open

[Question] GraalVM native support #105

jefffang123 opened this issue Jan 28, 2025 · 1 comment

Comments

@jefffang123
Copy link

In README I can see GraalVM native image support should be there for both server and client.

And in the latest release 0.3.0 the version for grpc-java is updated to 1.69.0 in BOM.

But grpc-java 1.69.0 seems to introduce a runtime reflection which requires reflection metadata registration, currently when I run the native code built against grpc-java 1.69.+ I can see the errors:

Caused by: java.lang.AssertionError: java.lang.NoSuchMethodException: java.time.Instant.now()
        at io.grpc.internal.InstantTimeProvider.<init>(InstantTimeProvider.java:39)
        at io.grpc.internal.TimeProviderResolverFactory.resolveTimeProvider(TimeProviderResolverFactory.java:27)
        at io.grpc.internal.TimeProvider.<clinit>(TimeProvider.java:27)
        at io.grpc.internal.TransportTracer.<clinit>(TransportTracer.java:30)
        at io.grpc.netty.NettyServerBuilder.<init>(NettyServerBuilder.java:91)
        at io.grpc.netty.NettyServerBuilder.forAddress(NettyServerBuilder.java:147)
        at io.grpc.netty.NettyServerBuilder.forPort(NettyServerBuilder.java:127)
        at io.grpc.netty.NettyServerProvider.builderForPort(NettyServerProvider.java:40)
        at io.grpc.netty.NettyServerProvider.builderForPort(NettyServerProvider.java:25)
        at io.grpc.ServerBuilder.forPort(ServerBuilder.java:44)

Question:

Will spring-grpc repo solve this problem, or do we leave it to upstream libraries, probably not just grpc-java because other dependencies such as protobuf might have these problems in future

Or do we assume this will be solved by community? e.g https://github.com/oracle/graalvm-reachability-metadata

@dsyer
Copy link
Collaborator

dsyer commented Jan 28, 2025

I think up to now we have been relying on https://github.com/oracle/graalvm-reachability-metadata/tree/master/metadata/io.grpc/grpc-netty. I don't see a reason to change that, but someone will have to send some changes to them. Short term we could add some hints in this project, I suppose. FWIW this works for me in the grpc-server sample (reflect-config.json):

[
	{
	  "condition": {
		"typeReachable": "io.grpc.internal.InstantTimeProvider"
	  },
	  "name": "java.time.Instant",
	  "allDeclaredMethods": true
	}
]

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

2 participants