Fix ProxyProvider hash function leading to memory leakage #728
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
it seems i triggered a memory leak by registering a proxy with
reactor.netty.http.client.HttpClient.create().tcpConfiguration(this::configureProxy)
as the lambda is called for every connection due to the ChannelHandler being a "different" one in every call ofreactor/netty/resources/PooledConnectionProvider.java:137
i guess the problem is that the used hash function
reactor.netty.tcp.ProxyProvider#hashCode
includes the nonProxyHosts as a regex pattern which gets his hash function fromjava.lang.Object#hashCode
and therefore fails to recognize equal regexes. The tests insrc/test/java/reactor/netty/tcp/ProxyProviderTest.java
did not break because they get null as test fixture for nonProxyHosts.This ultimately causes the
reactor.netty.resources.PooledConnectionProvider#channelPools
to grow indefinitely once a proxy with definednonProxyHosts
is used, no matter if the connection is actually proxied or not.