spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.54k stars 3.33k forks source link

HttpClientProperties evictInBackground support #2153

Closed Fetsivalen closed 3 years ago

Fetsivalen commented 3 years ago

Enhancement

In reactor-netty 0.9.13, an ability was added to configure a background connections eviction.

See: https://github.com/reactor/reactor-netty/pull/1329

It would be great if Spring Cloud Gateway exposed this configuration option via HttpClientProperties. The default could be Duration.ZERO, (meaning there is no background eviction). This could be useful during the investigation of the connection leak and as an ability to avoid connection evictions on request.

tony-clarke-amdocs commented 3 years ago

@Fetsivalen if eviction doesn't occur in the background, then when does the eviction predicate get evaluated?

Fetsivalen commented 3 years ago

@tony-clarke-amdocs from what i see it happens on request. See explanation here: https://github.com/reactor/reactor-netty/issues/612#issuecomment-515984327 From what I understand it is how conections managed currently. My issue is that leak happens on 400 (non 101 actually) http response code on establishing ws connection, but for now i'm trying to track down is it an issue in reactor netty or in my code.

eugene-sadovsky commented 3 years ago

I ran into this too recently. In my case memory leaks because of downstream services change their IPs quite often. See https://github.com/reactor/reactor-netty/issues/1556 for more details