Prior to this patch whenever updateMetadata() was called and a valid connection was available, the connection would leak and another would be created. This is because the predicate passed to _.find() was deleting the connection from the oldConnections object before it was read by underscore.
An easy way to reproduce the leak is to use the Producer to send to a non-existent topic in a loop. This will cause updateMetadata() to be called for the failed message sends, leaking the Connection and 256KB underlying Buffer in the socket.
Prior to this patch whenever
updateMetadata()
was called and a valid connection was available, the connection would leak and another would be created. This is because the predicate passed to_.find()
was deleting the connection from theoldConnections
object before it was read by underscore.An easy way to reproduce the leak is to use the
Producer
to send to a non-existent topic in a loop. This will causeupdateMetadata()
to be called for the failed message sends, leaking the Connection and 256KB underlying Buffer in the socket.