[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17115513#comment-17115513 ] Gregory Koshelev commented on KAFKA-3450: - Hi [~mjsax], As for me, KAFKA-3450 has 2 issues: # {{Producer.send()}} is blocked for up to {{max.block.ms}}. # Client repeatedly requests broker for metadata of non-existing topic for a long time. KAFKA-3539 is about the first one. > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producer producer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17013110#comment-17013110 ] Matthias J. Sax commented on KAFKA-3450: Seem KAFKA-3539 is a duplicate? > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producer producer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 5 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.433 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread |
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16764997#comment-16764997 ] Michal Turek commented on KAFKA-3450: - Hi [~ijuma], is the question for me as the bug creator? We don't want to let the client applications to create the topics at their will, so we have disabled this possibility using auto.create.topics.enable=false. The creation of the topic is not solution for us because it's exactly the thing we want to prevent. Kafka brokers know about this (their) configuration but they are unable to propagate this information to the clients so they stuck for extremely long time (minute) in a loop of timeouts and failures. They block the caller's thread (async but blocking api) and are fully unable to communicate after the used thread pool become exhausted. Kafka broker responds "topic doesn't exist" to the client but it should return "topic doesn't exist and it will never be available" to quickly break the unnecessary loop of retries. > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producer producer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient >
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16764852#comment-16764852 ] Ismael Juma commented on KAFKA-3450: It would be useful to understand what is the desired behaviour here. Generally, if you don't expect the topic to be there, `AdminClient` can be used to create the topic if it doesn't exist. > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producer producer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 5 : >
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16712077#comment-16712077 ] Aleksandar Nikolic commented on KAFKA-3450: --- Hi [~tu...@avast.com], Same problem with 2.0.1. Is there some workaround or plan to resolve issue? > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producer producer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 5 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.433 WARN
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16372875#comment-16372875 ] Josef Ludvíček commented on KAFKA-3450: --- Same problem with 0.11.0.1 Is there any plan to resolve this issue or any recommendation to work around ? > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producerproducer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 5 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.433
[jira] [Commented] (KAFKA-3450) Producer blocks on send to topic that doesn't exist if auto create is disabled
[ https://issues.apache.org/jira/browse/KAFKA-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16067579#comment-16067579 ] Sandokan Dias commented on KAFKA-3450: -- Same problem here when the topic.auto.create is disabled. Kafka client (java) version: 0.10.1.0 > Producer blocks on send to topic that doesn't exist if auto create is disabled > -- > > Key: KAFKA-3450 > URL: https://issues.apache.org/jira/browse/KAFKA-3450 > Project: Kafka > Issue Type: Bug > Components: producer >Affects Versions: 0.9.0.1 >Reporter: Michal Turek >Priority: Critical > > {{producer.send()}} is blocked for {{max.block.ms}} (default 60 seconds) if > the destination topic doesn't exist and if their automatic creation is > disabled. Warning from NetworkClient containing UNKNOWN_TOPIC_OR_PARTITION is > logged every 100 ms in a loop until the 60 seconds timeout expires, but the > operation is not recoverable. > Preconditions > - Kafka 0.9.0.1 with default configuration and auto.create.topics.enable=false > - Kafka 0.9.0.1 clients. > Example minimalist code > https://github.com/avast/kafka-tests/blob/master/src/main/java/com/avast/kafkatests/othertests/nosuchtopic/NoSuchTopicTest.java > {noformat} > /** > * Test of sending to a topic that does not exist while automatic creation of > topics is disabled in Kafka (auto.create.topics.enable=false). > */ > public class NoSuchTopicTest { > private static final Logger LOGGER = > LoggerFactory.getLogger(NoSuchTopicTest.class); > public static void main(String[] args) { > Properties properties = new Properties(); > properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, > "localhost:9092"); > properties.setProperty(ProducerConfig.CLIENT_ID_CONFIG, > NoSuchTopicTest.class.getSimpleName()); > properties.setProperty(ProducerConfig.MAX_BLOCK_MS_CONFIG, "1000"); > // Default is 60 seconds > try (Producerproducer = new > KafkaProducer<>(properties, new StringSerializer(), new StringSerializer())) { > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExist", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > LOGGER.info("Sending message"); > producer.send(new ProducerRecord<>("ThisTopicDoesNotExistToo", > "key", "value"), (metadata, exception) -> { > if (exception != null) { > LOGGER.error("Send failed: {}", exception.toString()); > } else { > LOGGER.info("Send successful: {}-{}/{}", > metadata.topic(), metadata.partition(), metadata.offset()); > } > }); > } > } > } > {noformat} > Related output > {noformat} > 2016-03-23 12:44:37.725 INFO c.a.k.o.nosuchtopic.NoSuchTopicTest [main]: > Sending message (NoSuchTopicTest.java:26) > 2016-03-23 12:44:37.830 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 0 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:37.928 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 1 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.028 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 2 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.130 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 3 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.231 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 4 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.332 WARN o.a.kafka.clients.NetworkClient > [kafka-producer-network-thread | NoSuchTopicTest]: Error while fetching > metadata with correlation id 5 : > {ThisTopicDoesNotExist=UNKNOWN_TOPIC_OR_PARTITION} (NetworkClient.java:582) > 2016-03-23 12:44:38.433 WARN