Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Kafka producer leaks TcpClient connections if a broker is not responding #17

Open
tteats opened this issue Nov 7, 2012 · 0 comments
Open
Assignees

Comments

@tteats
Copy link

tteats commented Nov 7, 2012

When a producer is instantiated and populateProducerPool is set to true (which is the default case), then a socket is opened for every broker. If the client fails to connect to the broker and it is not the first broker it is trying to connect to (i.e. not broker with id==0), then when an exception is thrown, none of the broker connections that have already been connected get disconnected. If the client keeps trying to connect, eventually the client will run out of available connections causing other unintended consequences for other parts of the process.

Repro:)

  1. Configure 2 brokers and start them.
  2. zk broker nodes are supposed to be ephemeral for brokers, but in practice this isn't always the case. The client needs to account for this. Check out the brokers in zk with path /brokers/ids. Take a broker id that is not the first one (likely broker id == 1) and copy the value of the znode. Once you have the data, stop the kafka server with broker id == 1. This should remove the broker from ids in zk. Add it back using manually to replicate an issue where the node does not properly get cleaned up.
  3. Create a new Producer object

Result: An exception is thrown b/c the client cannot connect to the client. Further, the connection to broker 0 is not disposed.

Expected: Constructor at the very least should clean up the open connection. For extra credit, the connections should not be opened for a broker until it is actually sending data to that particular broker. Connections should also respect kafka configurations for reconnectInterval and reconnectTimeInterval which will freshen the connection periodically.

@ghost ghost assigned tteats Nov 7, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant