temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
200 stars 134 forks source link

Upgrade grpc dependencies #1985

Closed isacandrei closed 4 months ago

isacandrei commented 5 months ago

Is your feature request related to a problem? Please describe. We are currently using Quarkus 3.6.9 with the Temporal Java SDK to run Temporal workers. Quakus typically enforces quite a recent version of the grpc-bom. In the above mentioned version, it is 1.59.0, but in the soon to be releases LTS version it will most likely be 1.61.1.

The problem is that this version introduces breaking changes - v1.59.0, which forces us to enforce a lower version of the GRPC libraries in all projects using the Temporal SDK.

Describe the solution you'd like Upgrade the grpc dependencies to a version > 1.59.

Describe alternatives you've considered Right now, we pinpointing an older version for the grpc-bom and that works just fine as long as we don't use grpc for any other use-case within the same service.

Quinn-With-Two-Ns commented 5 months ago

What breaking changes in 1.59.0 are you referring to? The Java SDK with its current dependencies is not affected by the ABI breakage in 1.59.0 I am aware of users successfully using 1.59.0 with the Java SDK.

isacandrei commented 5 months ago

The problem I ran into was coming from the the test tooling:

org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
        at app//io.quarkus.test.junit.QuarkusTestExtension.initTestState(QuarkusTestExtension.java:784)
        at app//io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:750)
        at java.base@17.0.9/java.util.Optional.orElseGet(Optional.java:364)
        at java.base@17.0.9/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base@17.0.9/java.util.ArrayList.forEach(ArrayList.java:1511)

        Caused by:
        java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
            at io.quarkus.runner.bootstrap.RunningQuarkusApplicationImpl.instance(RunningQuarkusApplicationImpl.java:90)
            at io.quarkus.test.junit.QuarkusTestExtension.createActualTestInstance(QuarkusTestExtension.java:790)
            at io.quarkus.test.junit.QuarkusTestExtension.initTestState(QuarkusTestExtension.java:778)
            ... 4 more

            Caused by:
            java.lang.reflect.InvocationTargetException
                at java.base/java.lang.reflect.Method.invoke(Method.java:568)
                at io.quarkus.runner.bootstrap.RunningQuarkusApplicationImpl.instance(RunningQuarkusApplicationImpl.java:88)
                ... 6 more

                Caused by:
                java.lang.NoClassDefFoundError: io/grpc/inprocess/InProcessServerBuilder
                    at io.temporal.internal.testservice.TestWorkflowService$Client.<init>(TestWorkflowService.java:135)
                    at io.temporal.internal.testservice.TestWorkflowService.<init>(TestWorkflowService.java:170)
                    at io.temporal.testing.TestWorkflowEnvironmentInternal.<init>(TestWorkflowEnvironmentInternal.java:64)
                    at io.temporal.testing.TestWorkflowEnvironment.newInstance(TestWorkflowEnvironment.java:95)
                    at io.beekeeper.data.governance.service.helpers.TemporalTestSupport.produceTestWorkflowEnvironment(TemporalTestSupport.java:43)
                    at io.beekeeper.data.governance.service.helpers.TemporalTestSupport_ProducerMethod_produceTestWorkflowEnvironment_de1jZMWvwvWHAR2TO30lLYEL0qE_Bean.doCreate(Unknown Source)
                    at io.beekeeper.data.governance.service.helpers.TemporalTestSupport_ProducerMethod_produceTestWorkflowEnvironment_de1jZMWvwvWHAR2TO30lLYEL0qE_Bean.create(Unknown Source)
                    at io.beekeeper.data.governance.service.helpers.TemporalTestSupport_ProducerMethod_produceTestWorkflowEnvironment_de1jZMWvwvWHAR2TO30lLYEL0qE_Bean.get(Unknown Source)
                    at io.beekeeper.data.governance.service.helpers.TemporalTestSupport_ProducerMethod_produceTestWorkflowEnvironment_de1jZMWvwvWHAR2TO30lLYEL0qE_Bean.get(Unknown Source)
                    at io.beekeeper.data.governance.service.workflows.definitions.TenantDataCleanupWorkflowTest_Bean.doCreate(Unknown Source)
                    at io.beekeeper.data.governance.service.workflows.definitions.TenantDataCleanupWorkflowTest_Bean.create(Unknown Source)
                    at io.beekeeper.data.governance.service.workflows.definitions.TenantDataCleanupWorkflowTest_Bean.get(Unknown Source)
                    at io.beekeeper.data.governance.service.workflows.definitions.TenantDataCleanupWorkflowTest_Bean.get(Unknown Source)
                    at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:325)
                    at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:309)
                    at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:190)
                    ... 8 more

                    Caused by:
                    java.lang.ClassNotFoundException: io.grpc.inprocess.InProcessServerBuilder
                        at io.temporal.internal.testservice.TestWorkflowService$Client.<init>(TestWorkflowService.java:135)
                        ... 23 more
Quinn-With-Two-Ns commented 4 months ago

I don't believe InProcessServerBuilder is affected by the ABI breakage. I am not familiar with Quarkus, but I can post a sample showing the Java-SDK working with the latest grpc.

isacandrei commented 4 months ago

ok, I dug a little bit more into it. The problem is that the class io/grpc/inprocess/InProcessServerBuilder was moved from io.grpc:grpc-core to io.grpc:grpc-inprocess, which is not included in the temporal-sdk, as it only has been published since version 1.58.