500 Server Error is streaming in the SCG (Spring Cloud Gateway) pod.
$ kubectl logs scg-pod -n app-ns
...
{"level":"error","ts":"2024-12-29T22:13:52.811Z","logger":"org.springframework.web.server.adapter.HttpWebHandlerAdapter","thread":"reactor-http-epoll-1","context":"default","msg":"[fb84cd8d-687612] 500 Server Error for HTTP GET "/constraints/constraint-sets?dealerId=123456&product=ABCD"
...
A possible reason is that the server is timing out idle connections. Because reactor-netty does not have a default idle time, the next time the gateway attempts to reuse an idle connection from the pool after that server timeout has elapsed, a failure is observed.
One solution is to turn off connection pooling by adding the SPRING_CLOUD_GATEWAY_HTTPCLIENT_POOL_TYPE environment variable to your SpringCloudGateway definition and setting the value to DISABLED. For example:
apiVersion: "tanzu.vmware.com/v1"
kind: SpringCloudGateway
metadata:
name: test-gateway
spec:
env:
- name: SPRING_CLOUD_GATEWAY_HTTPCLIENT_POOL_TYPE
value: DISABLED
The default value for SPRING_CLOUD_GATEWAY_HTTPCLIENT_POOL_TYPE is ELASTIC. Please see the difference between the two values:
Please raise a Tanzu support ticket if the above solution is not able to get issue solved.