aloyszhang commented on a change in pull request #13055: URL: https://github.com/apache/pulsar/pull/13055#discussion_r761189793
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java ########## @@ -1562,6 +1562,12 @@ public void connectionFailed(PulsarClientException exception) { log.info("[{}] Producer creation failed for producer {} after producerTimeout", topic, producerId); } setState(State.Failed); + // release resource if the produce is going to be cleaned + try { + this.close(); + } catch (PulsarClientException e) { + log.warn("[{}] Close a failed produce {} failed", topic, producerId, e); Review comment: This is because the test https://github.com/apache/pulsar/blob/master/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicDoesNotExistsTest.java#L68. IF auto-create is not allowed Before this pull request, building a producer will get a `CommandError` from the broker which will close the produce. With this pull request, we will get a `connectionFailed` after lookup the brokerUrl, and this failure does not close the produce which will failed the test. I'll remove the test in this pull request, and open an new issue for the connectionFailed processing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org