After upgrading a Spring Cloud Gateway application to Spring Cloud 2024.0.0, the application encounters a java.lang.OutOfMemoryError related to direct buffer memory allocation.
The application logs output the following error:
ERROR [<app-name>,,] [reactor-http-epoll-8] [629c9dd1] Error [reactor.netty.ReactorNetty$InternalNettyException: java.lang.OutOfMemoryError: Cannot reserve 65536 bytes of direct buffer memory (allocated: 10484501, limit: 10485760)] for HTTP POST "/xxxxxx/xxxxxx", but ServerHttpResponse already committed (200 OK)Symptoms:
Large API requests complete successfully when the application first starts.
Over time, identical large requests begin to fail as the direct buffer memory limit is exhausted.
Note: This specific behavior and error trace was captured from an application running on TPCF (Tanzu Platform for Cloud Foundry).
Java: 21
Spring Cloud: 2024.0.0
Spring Boot: 3.4.x (Spring Framework 6.2)
Reactor Netty: 1.2.x
Library: spring-cloud-gateway
Platform: TPCF
This error is caused by a known issue within the Spring Cloud 2024.0.0 release line. To resolve this and prevent direct memory exhaustion, upgrade your application's dependencies to the patched versions.
Action Required: