Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-4477

RestEasy reactive client @Retry fails in native mode

    • Red Hat build of Quarkus

      A RestEasy reactive client marked with @Retry works correctly in java mode (i.e. when there are failures, the client makes multiple calls according to the configured fault-tolerance policies).

      The same code fails when running in native mode per below:

      DEBUG [com.example.AbstractResteasyReactiveContext] (executor-thread-2) Restarting handler chain for exception exception: jakarta.ws.rs.ProcessingException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=com.example.RequestIdManagerImpl, id=930399259eca7cd1255a5f248739c56793fa5533]
              - you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
              at org.jboss.resteasy.reactive.client.handlers.ClientRequestFilterRestHandler.handle(ClientRequestFilterRestHandler.java:28)
              at org.jboss.resteasy.reactive.client.handlers.ClientRequestFilterRestHandler.handle(ClientRequestFilterRestHandler.java:10)
              at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.invokeHandler(AbstractResteasyReactiveContext.java:229)
              at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
              at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.performRequestInternal(AsyncInvokerImpl.java:285)
              at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.performRequestInternal(AsyncInvokerImpl.java:275)
              at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.method(AsyncInvokerImpl.java:215)
              at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.method(AsyncInvokerImpl.java:29)
              at com.example.ClientResource$$QuarkusRestClientInterface.getItemsAsync(Unknown Source)
              at com.example.ClientResource$$CDIWrapper.getItemsAsync(Unknown Source)
              at com.example.ClientResource$$CDIWrapper_Subclass.getItemsAsync$$superforward(Unknown Source)
              at com.example.ClientResource$$CDIWrapper_Subclass$$function$$1.apply(Unknown Source)
              at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
              at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
              at io.smallrye.faulttolerance.internal.InterceptionInvoker.proceed(InterceptionInvoker.java:38)
              at io.smallrye.faulttolerance.core.invocation.CompletionStageSupport.toCompletionStage(CompletionStageSupport.java:25)
              at io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$asyncFlow$1(FaultToleranceInterceptor.java:237)
              at io.smallrye.faulttolerance.core.InvocationContext.call(InvocationContext.java:20)
              at io.smallrye.faulttolerance.core.Invocation.apply(Invocation.java:29)
              at io.smallrye.faulttolerance.internal.RequestScopeActivator.apply(RequestScopeActivator.java:27)
              at io.smallrye.faulttolerance.core.async.CompletionStageExecution.lambda$doApply$0(CompletionStageExecution.java:46)
              at io.smallrye.faulttolerance.core.util.DirectExecutor.execute(DirectExecutor.java:17)
              at io.smallrye.faulttolerance.core.async.CompletionStageExecution.doApply(CompletionStageExecution.java:44)
              at io.smallrye.faulttolerance.core.async.CompletionStageExecution.apply(CompletionStageExecution.java:34)
              at io.smallrye.faulttolerance.core.async.CompletionStageExecution.apply(CompletionStageExecution.java:21)
              at io.smallrye.faulttolerance.core.retry.CompletionStageRetry.afterDelay(CompletionStageRetry.java:88)
              at io.smallrye.faulttolerance.core.retry.CompletionStageRetry.lambda$doRetry$0(CompletionStageRetry.java:60)
              at io.smallrye.faulttolerance.core.timer.ThreadTimer.lambda$new$1(ThreadTimer.java:90)
              at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
              at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:581)
              at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
              at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1512)
              at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
              at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
              at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
              at java.base@17.0.10/java.lang.Thread.run(Thread.java:840)
              at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
              at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:210)
      Caused by: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=com.example.RequestIdManagerImpl, id=930399259eca7cd1255a5f248739c56793fa5533]
              - you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
              at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:55)
              at com.example.RequestIdManagerImpl_ClientProxy.arc$delegate(Unknown Source)
              at com.example.RequestIdManagerImpl_ClientProxy.currentRequestId(Unknown Source)
              at com.example.RequestIdClientRequestFilter.filter(RequestIdClientRequestFilter.java:23)
              at com.example.RequestIdClientRequestFilter_ClientProxy.filter(Unknown Source)
              at org.jboss.resteasy.reactive.client.handlers.ClientRequestFilterRestHandler.handle(ClientRequestFilterRestHandler.java:25)
              ... 37 more

            [QUARKUS-4477] RestEasy reactive client @Retry fails in native mode

            Errata Tool added a comment -

            Since the problem described in this issue should be resolved in a recent advisory, it has been closed.

            For information on the advisory (Moderate: Red Hat build of Quarkus 3.8.6 release and security update), and where to find the updated files, follow the link below.

            If the solution does not work for you, open a new bug report.
            https://access.redhat.com/errata/RHSA-2024:6437

            Errata Tool added a comment - Since the problem described in this issue should be resolved in a recent advisory, it has been closed. For information on the advisory (Moderate: Red Hat build of Quarkus 3.8.6 release and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2024:6437

            Marking as verified with RHBQ 3.8.6 CR2.

            Developed tests passed with the build.

            Rostislav Svoboda added a comment - Marking as verified with RHBQ 3.8.6 CR2. Developed tests passed with the build.

            Rostislav Svoboda added a comment - TD: https://github.com/quarkus-qe/quarkus-test-suite/pull/1972

            The scope for 3.8.5 is already set so this won't make it into 3.8.5. We can look at adding it to 3.8.6, which is 1-2 months away. This is what I suggest. 

             

            1. We issue a rebuilt version of smallrye-faulttolerance for RHBQ 3.2 with the specific patch in it that we either publish to MRRC or in the support case.
            2. We include the patch in RHBQ 3.2.NEXT and 3.8.NEXT, but that will be 1-3 months away.

            rhn-support-mmillson WDYT?

             

             

            Thomas Qvarnström added a comment - The scope for 3.8.5 is already set so this won't make it into 3.8.5. We can look at adding it to 3.8.6, which is 1-2 months away. This is what I suggest.    We issue a rebuilt version of smallrye-faulttolerance for RHBQ 3.2 with the specific patch in it that we either publish to MRRC or in the support case. We include the patch in RHBQ 3.2.NEXT and 3.8.NEXT, but that will be 1-3 months away. rhn-support-mmillson WDYT?    

            Ladislav Thon added a comment - Added the backport labels to https://github.com/quarkusio/quarkus/pull/39988

            I found that the reproducer works as expected in Quarkus 3.10, and after some time (git bisect didn't work for some reason...), I found the fix: https://github.com/quarkusio/quarkus/pull/39988/commits/b9cc3c2dc65a6f61641c83a940e13c116ce6cd0c

            Backporting that commit to 3.2 and 3.8 seems straightforward, no conflicts. I didn't try backporting the entire PR (4 commits). gsmet@redhat.com could you please advise how to proceed? Should I submit PRs upstream against the 3.2 / 3.8 branches?

            Ladislav Thon added a comment - I found that the reproducer works as expected in Quarkus 3.10, and after some time ( git bisect didn't work for some reason...), I found the fix: https://github.com/quarkusio/quarkus/pull/39988/commits/b9cc3c2dc65a6f61641c83a940e13c116ce6cd0c Backporting that commit to 3.2 and 3.8 seems straightforward, no conflicts. I didn't try backporting the entire PR (4 commits). gsmet@redhat.com could you please advise how to proceed? Should I submit PRs upstream against the 3.2 / 3.8 branches?

            Attached reproducer (with permission). See enclosed README.

            Michael Millson added a comment - Attached reproducer (with permission). See enclosed README.

            lthon@redhat.com can you take a look as this looks like a Fault Tolerance issue?

            Georgios Andrianakis added a comment - lthon@redhat.com can you take a look as this looks like a Fault Tolerance issue?

              lthon@redhat.com Ladislav Thon
              rhn-support-mmillson Michael Millson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: