Build Temporal Worker with Quarkus

Hi all, I am deploying an Temporal Worker with Quarkus. When I built app with native-build mode, I got this error

Error: Unsupported features in 12 methods
Detailed message:
Error: An object of type 'io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default.
This is not allowed for correctness reasons: All objects that are stored in the image heap must be initialized at build time.
You now have two options to resolve this:
1) If it is intended that objects of type 'io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator' are persisted in the image heap, add 
    '--initialize-at-build-time=io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator'
to the native-image arguments. Note that initializing new types can store additional objects to the heap. It is advised to check the static fields of 'io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator' to see if they are safe for build-time initialization,  and that they do not contain any sensitive data that should not become part of the image.
2) If these objects should not be stored in the image heap, you can use 
    '--trace-object-instantiation=io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator'
to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 
    '--initialize-at-run-time=<culprit>'
to prevent the instantiation of the object.
If you are seeing this message after enabling '--strict-image-heap', this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include '--initialize-at-build-time=io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.
The following detailed trace displays from which field in the code the object was reached.
Trace: Object was reached by
  trying to constant fold static field io.grpc.netty.shaded.io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.allocator
    at io.grpc.netty.shaded.io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.access$200(Utils.java:99)
  parsing method io.grpc.netty.shaded.io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.access$200(Utils.java:99) reachable via the parsing context
    at static root method.(Unknown Source)

Even when I follow their advices, add , It still seem not fine

Detailed message: Error: Discovered unresolved method during parsing: io.temporal.internal.testservice.InProcessGRPCServer.<init>(java.util.Collection). This error is reported at image build time because class io.temporal.serviceclient.WorkflowServiceStubsImpl is registered for linking at image build time by command line and command line. Error encountered while parsing io.temporal.serviceclient.WorkflowServiceStubs.newServiceStubs(WorkflowServiceStubs.java:65)

Do you guy ever experience with this issue? And if yes, how did you fix it?

Thanks for help in advance!

Hi there, @anyi! While I don’t know the answer to your question unfortunately, I wanted to raise that there’s now a Temporal Quarkus extension that might make integrating Temporal + Quarkus easier. (This was reported by Tim in our #show-us-what-you-got channel on Temporal Community Slack).

There’s also an accompanying demo repo and podcast where they show how to use it! Hope this helps.

See sdk-java/docs/AOT-native-image.md at master · temporalio/sdk-java · GitHub for native image and native image tracing agent info.

Regarding the mentioned Quarkus extension, please note that we cannot provide community support for any issues when using 3rd party libraries that we do not control (unless you can clearly show that issue is related strictly to Temporal itself outside of that library as well)

1 Like