02tmqrmje9 created KAFKA-7113: --------------------------------- Summary: AdminClient.create has an infinite retry loop bug Key: KAFKA-7113 URL: https://issues.apache.org/jira/browse/KAFKA-7113 Project: Kafka Issue Type: Bug Reporter: 02tmqrmje9
When you try to instantiate an KafkaAdminClient using the factory method AdminClient.create it returns a client while side-effecting with a background thread stuck in a retry loop forever attempting to get broker metadata when brokers are not accessible. Running the below code: {code:java} val props = new Properties() props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:8080) AdminClient.create(props) {code} Will result in an endless loop of the below forever: {code:java} Connection to node -1 could not be established. Broker may not be available {code} As create returns an AdminClient value straight away and forks to a background thread there is no way to know if the client instantiated successfully or not and to handle the error case. * Calling create ideally should not side affect as it's equivalent to a side-effecting constructor * At the least calling create should fatally fail if it can't talk to the brokers so the error case can be handled, i.e so a user can fail fast and propagate errors. -- This message was sent by Atlassian JIRA (v7.6.3#76005)