oleksiyk / kafka

Apache Kafka 0.9 client for Node
MIT License
297 stars 85 forks source link

Fix connection leak after metadata update #232

Closed jdconley closed 5 years ago

jdconley commented 5 years ago

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.

oleksiyk commented 5 years ago

Thanks!

oleksiyk commented 5 years ago

Published as 3.3.4