9

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?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
CDan
  • 103
  • 3
  • 6
  • 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. – Jeppz Sep 11 '20 at 16:57
  • 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 https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/web-reactive.html#webflux-codecs-limits – Toerktumlare Sep 11 '20 at 18:15
  • If you use Spring cloud, then this question might be relevant: https://stackoverflow.com/questions/62415728/spring-cloud-hoxton-sr5-issue-with-eureka-and-webflux-exceeded-limit-on-max-byt – Martin Tarjányi Sep 11 '20 at 18:48
  • it depends on where this is being thrown and the codec used. Could you post the complete stacktrace? – Brian Clozel Sep 13 '20 at 08:53
  • 1
    @CDan, did you get the solution? I am also facing same problem and no solution from other references is working... – Saqib Rezwan Feb 16 '21 at 07:53

1 Answers1

2

you can add the following configuration:

enter image description here

enter image description here

Andrea Ciccotta
  • 598
  • 6
  • 16