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

StackOverflowError after upgrading to RestEasy 4.5.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 4.5.5.Final
    • 4.5.0.Final, 4.5.1.Final, 4.5.2.Final
    • jaxrs
    • None

      After upgrading to RestEasy from 4.4.2 to 4.5.2, I got a StackOverflowError when returning a response with an entity InputStream. Returning a basic 10MB stream fails.

      Bug reproductible with very basic code:

      @Path("/")
      public class TestResource {
      
          @GET
          @Produces(MediaType.APPLICATION_OCTET_STREAM)
          @Path("/{size}")
          public Response donwload(@PathParam("size") long size) {
              return Response.ok(new NullInputStream(size)).build();
          }
      }
      

      Requesting :

      localhost:8000/1000000 (1MB) ==> OK
      localhost:8000/10000000 (10MB) ==> *StackOverflowError*
      

      I get :

      org.eclipse.jetty.server.HttpChannelOverHttp.handleException(HttpChannelOverHttp.java:488) :  java.lang.StackOverflowError: null
              at org.eclipse.jetty.util.BufferUtil.fill(BufferUtil.java:503)
              at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:791)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.write(HttpServletResponseWrapper.java:153)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$AsyncOperation.work(HttpServletResponseWrapper.java:41)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.queue(HttpServletResponseWrapper.java:219)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.asyncWrite(HttpServletResponseWrapper.java:180)
              at org.jboss.resteasy.util.CommitHeaderAsyncOutputStream.asyncWrite(CommitHeaderAsyncOutputStream.java:94)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.writeTo(ProviderHelper.java:171)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.lambda$writeTo$1(ProviderHelper.java:172)
              at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.writeTo(ProviderHelper.java:172)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.lambda$writeTo$1(ProviderHelper.java:172)
              at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.writeTo(ProviderHelper.java:172)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.lambda$writeTo$1(ProviderHelper.java:172)
              ...
              at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
              at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.writeTo(ProviderHelper.java:172)
              at org.jboss.resteasy.plugins.providers.ProviderHelper.lambda$writeTo$1(ProviderHelper.java:172)
              ...
      
      

              separdau@redhat.com Stephane Epardaud
              gheribil Lotfi GHERIBI (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: