Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2534

Suspended Filter and Suspended Method produce 400 Response

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 4.5.2.Final
    • Vert.X integration
    • None
    • Hide
      • Create Named Filter with suspended SuspendableContainerRequestContext
      • Create Resource Method with @Suspended AsyncResponse as Parameter, which uses the named filter
        -> Calling Resource is aborted with 400 Response
      Show
      Create Named Filter with suspended SuspendableContainerRequestContext Create Resource Method with @Suspended AsyncResponse as Parameter, which uses the named filter -> Calling Resource is aborted with 400 Response
    • Show
      Use reactive return type ( https://docs.jboss.org/resteasy/docs/4.3.1.Final/userguide/html_single/index.html#d4e2121 )

      Using a SuspendableContainerRequestContext in a named filter and @Suspended AsyncResponse in the resource method produces a 400 Response. Using reactive return types works as expected.

      The cause is an exception thrown because the Request is already marked as suspended:

      0 = {StackTraceElement@8899} "org.jboss.resteasy.plugins.server.vertx.VertxHttpRequest$VertxExecutionContext.suspend(VertxHttpRequest.java:229)"
      1 = {StackTraceElement@8900} "org.jboss.resteasy.plugins.server.vertx.VertxHttpRequest$VertxExecutionContext.suspend(VertxHttpRequest.java:221)"
      2 = {StackTraceElement@8901} "org.jboss.resteasy.plugins.server.vertx.VertxHttpRequest$VertxExecutionContext.suspend(VertxHttpRequest.java:215)"
      3 = {StackTraceElement@8902} "org.jboss.resteasy.core.AsynchronousResponseInjector.inject(AsynchronousResponseInjector.java:36)"
      4 = {StackTraceElement@8903} "org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:95)"
      5 = {StackTraceElement@8904} "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:128)"
      6 = {StackTraceElement@8905} "org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:621)"
      7 = {StackTraceElement@8906} "org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:487)"
      8 = {StackTraceElement@8907} "org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:437)"
      9 = {StackTraceElement@8908} "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)"
      10 = {StackTraceElement@8909} "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.resume(PreMatchContainerRequestContext.java:261)"
      11 = {StackTraceElement@8910} "de.comhix.anime.api.filter.AuthorizationFilter$filter$1.invokeSuspend(AuthorizationFilter.kt:71)"
      12 = {StackTraceElement@8911} "kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)"
      13 = {StackTraceElement@8912} "kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)"
      14 = {StackTraceElement@8913} "kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:113)"
      15 = {StackTraceElement@8914} "kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)"
      16 = {StackTraceElement@8915} "kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)"
      17 = {StackTraceElement@8916} "kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)"
      18 = {StackTraceElement@8917} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)"
      19 = {StackTraceElement@8918} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)"
      20 = {StackTraceElement@8919} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)"
      

      Attached kotlin files to reproduce the issue

        1. test-project.zip
          134 kB
        2. test.zip
          2 kB

            rsearls r searls
            nozomibk You DontNeed (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: