Set Max In Memory Size In Spring Webflux
Asked Answered
S

1

11

I am receiving the following error in a Spring Boot application using WebFlux

org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144

I tried setting the limit inside application.yml with

spring:
  codec:
    max-in-memory-size: 10MB

Or by adding the following to a WebClient configuration class but they are ignored.

.exchangeStrategies(ExchangeStrategies.builder()
        .codecs(clientCodecConfigurer -> clientCodecConfigurer
                .defaultCodecs()
                .maxInMemorySize(10 * 1024 * 1024)
        )
        .build()
)

I am Using Spring Boot 2.3.3.RELEASE.

Do you have any idea on what the problem might be?

Singularity answered 11/9, 2020 at 16:14 Comment(5)
Do you even need that much in memory? It could be a streaming issue with your code where you build up more than you should in memory.Scalawag
since we have no idea how the usage is when you are getting it i will just point ju to the documentation about different limits in webflux docs.spring.io/spring-framework/docs/current/…Doggy
If you use Spring cloud, then this question might be relevant: #62416228Arte
it depends on where this is being thrown and the codec used. Could you post the complete stacktrace?Apropos
@CDan, did you get the solution? I am also facing same problem and no solution from other references is working...Alberic
H
2

you can add the following configuration:

enter image description here

enter image description here

Hevesy answered 6/4, 2022 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.