Search code examples
springconnectiontimeoutgatewayreactor-netty

SOS HELP!! Ask for help: reactor-netty always io.netty.channel.ConnectionTimeoutException


I use spring cloud solution to build my apps, all them are SpringBoot applications, and use spring cloud gateway as an API Gateway for forward request.

Gateway use reactor-netty for forward the HTTP requests to other apps.

When I deploy my apps to pro environment, run apps in docker,each app has a separate docker container, and the container is a Linux. Then I got a lot of io.netty.channel.ConnectionTimeoutException.

The pro environment has a special limited for tcp connections, it will terminate a TCP connection when the connection not used in 240 seconds, and do not even send a notify.

I tried to use ConnectionProvider.newConnection() instead a pool provider, to ensure for every forward request is create a new Connection, but the TimeoutException still happened. I don't know why, and if it has something relate with 240 seconds limited.

I use Spring Cloud Gateway 2.1.3.RELEASE, and the reactor-netty version is 0.8.12.

May some one can tell me why and how to fix this problem.

The pro environment use NAT、ACS、SDN, I don't know what these words mean, may be it's helpful for this ask!

Thanks a lot!


Solution

  • Solved. upgrade reactor-netty to newest version, and create the ConnectionProvider with maxIdleTime parameter. But I still can not find out why the NewConnectionProvider not work.