-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LogbookClientHandler leads OutOfMemoryError on large Flux<DataBuffer> response body #1983
Comments
Perhaps is happens when there is a content-length header in streaming response. |
This fixed my OutOfMemoryError problem:
But I'm not sure if it's the right decision to use a buffer size equal to the length of the content because it could be too long. If everything is ok, please close this issue. |
Hi, @d-a-gerashenko ! class WithoutIsoContentTypeStrategy implements Strategy {
@Override
public HttpResponse process(final HttpRequest request, final HttpResponse response) throws IOException {
if(response.getContentType().equals("application/x-iso9660-image")) {
return response.withoutBody();
}
return response.withBody();
}
} Logbook.builder().strategy(new WithoutIsoContentTypeStrategy()).build() That is, if that server returns this particular Content-Type. It should work analogous to that with |
Hi, @ChristianLohmann But it could be a solution to add a condition to use WithoutBodyStrategy in case of large files. |
May be I'm wrong but in case of May be we just need an upper boundary for contentLength https://github.com/zalando/logbook/blob/main/logbook-netty/src/main/java/org/zalando/logbook/netty/Offering.java#L24 |
org.zalando.logbook.netty.LogbookClientHandler tries to allocate ByteBuf with size of Content-Length and it leads to OutOfMemoryError in case of large (more than JVM memory limit) body size which is transferred via "Flux<DataBuffer>".
Steps to Reproduce
This method leads to OutOfMemoryError:
Environment
Windows 11.
pom.xml
The text was updated successfully, but these errors were encountered: