Skip to content

PooledConnectionProvider create a new pool for each request #3885

@oaoaoaoaoaoammmm

Description

@oaoaoaoaoaoammmm

For proxy authorization we are forced to use one-time tokens. This leads to the fact that PooledConnectionProvide.channelPools grows for each request. This happens because in the ProxyProvider class, ProxyProvider.httpHeaders are used to calculate hashCode, in which the token changes for each request. Due to different hashCode, unequal PoolKey are created

Expected Behavior

One connection pool must be used

Actual Behavior

New pools are created for each request

Steps to Reproduce

Literally add such a proxy setting to any WebClient and it should reproduce

 private HttpClient setUpProxy(HttpClient currClient) {
        return currClient.proxy(
            pr -> pr.type(ProxyProvider.Proxy.HTTP)
                .host(proxyConfig.getHost())
                .port(proxyConfig.getPort())
                .httpHeaders(h -> h.add(HttpHeaders.PROXY_AUTHORIZATION, UUID.randomUUID().toString()))
        );
    }

Possible Solution

Maybe add a reduction or toggle to enable/disable ProxyProvider.httpHeaders in the hashCode calculation

Your Environment

  • Reactor version(s) used: io.projectreactor.netty:reactor-netty:1.2.8 io.projectreactor.netty:reactor-netty-core:1.2.8 io.projectreactor.netty:reactor-netty-http:1.2.8
  • JVM version (java -version): jdk 21
  • OS and version (eg. uname -a): windows\linux
Image

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions