reactor-netty: Memory leak when enabling `wiretap` (and other tcpClient bootstrap options)

Expected Behavior

Adding wiretap (or other tcpClient bootstrap options should not create excessive Micrometer meters.

Actual Behavior

When enabling HttpClient.create().wiretap(true) extra metrics are created like so:

reactor_netty_connection_provider_http_active_connections{id="1461210734",remote_address="localhost:443",} 0.0
reactor_netty_connection_provider_http_active_connections{id="1140564265",remote_address="localhost:443",} 0.0

This is because the id is generated from the hashcode of the BootStrap and the BootStrap is a lambda. (see https://github.com/reactor/reactor-netty/blob/d6a4300c69a8deb83f2e252e576975833faaab87/src/main/java/reactor/netty/resources/PooledConnectionProvider.java#L168)

Steps to Reproduce

Create an HttpClient and enable metrics(true).wiretap(true) and make several calls and check the meter registry.

Possible Solution

Don’t use a hashcode for the id. Or leave the ID off by default.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@checketts @skmedishetty Please move the discussion to the appropriate channels. I don’t think this issue is the right place.