После обновления до RestEasy с 4.4.2 до 4.5.2 я получил StackOverflowError
при возврате ответа с сущностью InputStream. Возврат базового c 10 МБ потока завершился неудачей.
Воспроизводимая ошибка с очень базовым c кодом:
@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();
}
}
Запрос:
localhost:8000/1000000 ==> OK
localhost:8000/10000000 ==> StackOverflowError
Я получаю:
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)
...