If there is a problem connecting to RabbitMQ in the LookupConnection and after 25 connection attempts with Address resolver, the connection does not close and throw exception, thereby causing a memory leak
Reproduction steps
use address resolver (for example host first of node (not balancer or proxy))
Leader need to be by 2 node
After 25 retry we got to exception by RoutingClientException($"Could not find broker ({broker.Host}:{broker.Port}) after {maxAttempts} attempts")
By second iteration of foreach brokers: connection success
we see failed and successfully tcp connection in active connections
Expected behavior
we see one of successfully tcp connection in active connections
Additional context
class RoutingHelper, method LookupConnection
while (broker.Host != advertisedHost || broker.Port != uint.Parse(advertisedPort))
{
....
if (attemptNo > maxAttempts)
{
await client.Close("advertised_host or advertised_port doesn't match").ConfigureAwait(false); // here we close the failed connection that caused the memory leak
throw new RoutingClientException(
$"Could not find broker ({broker.Host}:{broker.Port}) after {maxAttempts} attempts");
}
....
}
Describe the bug
If there is a problem connecting to RabbitMQ in the LookupConnection and after 25 connection attempts with Address resolver, the connection does not close and throw exception, thereby causing a memory leak
Reproduction steps
RoutingClientException($"Could not find broker ({broker.Host}:{broker.Port}) after {maxAttempts} attempts")
Expected behavior
we see one of successfully tcp connection in active connections
Additional context