You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
...
public long test() throws Exception {
Flux<DataBuffer> dataBufferFlux = WebClient.builder()
.clientConnector(
new ReactorClientHttpConnector(
HttpClient
.create()
.doOnConnected(conn -> {
//* <-- remove slash to make it work
conn
.addHandlerLast(
new LogbookClientHandler(
Logbook.builder()
.condition(Conditions.requestTo("/**"))
.requestFilter(RequestFilters.replaceBody(message -> ""))
.responseFilter(ResponseFilters.replaceBody(message -> ""))
.requestFilter(RequestFilters.replaceBody(BodyReplacers.binary()))
.responseFilter(ResponseFilters.replaceBody(BodyReplacers.binary()))
.requestFilter(RequestFilters.replaceBody(BodyReplacers.stream()))
.responseFilter(ResponseFilters.replaceBody(BodyReplacers.stream()))
.bodyFilter((contentType, body) -> "***")
.build()
)
);
//*/
})
)
)
.build()
.get()
.uri("https://mirror.team-host.ru/ubuntu-cdimage/24.04.1/ubuntu-24.04.1-desktop-amd64.iso")
.retrieve()
.bodyToFlux(DataBuffer.class);
Path path = Paths.get("large.dat");
DataBufferUtils.write(dataBufferFlux, path)
.block();
return Files.size(path);
}
...
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.
d-a-gerashenko
changed the title
org.zalando.logbook.netty.LogbookClientHandler leads OutOfMemoryError on large Flux<DataBuffer> response body
LogbookClientHandler leads OutOfMemoryError on large Flux<DataBuffer> response body
Dec 19, 2024
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: