Tom Bentley created KAFKA-9651: ---------------------------------- Summary: Divide by zero in DefaultPartitioner Key: KAFKA-9651 URL: https://issues.apache.org/jira/browse/KAFKA-9651 Project: Kafka Issue Type: Bug Reporter: Tom Bentley Assignee: Tom Bentley
The following exception was observed in a Kafka Streams application running on Kafka 2.3: java.lang.ArithmeticException: / by zero at org.apache.kafka.clients.producer.internals.DefaultPartitioner.partition(DefaultPartitioner.java:69) at org.apache.kafka.streams.processor.internals.DefaultStreamPartitioner.partition(DefaultStreamPartitioner.java:39) at org.apache.kafka.streams.processor.internals.StreamsMetadataState.getStreamsMetadataForKey(StreamsMetadataState.java:255) at org.apache.kafka.streams.processor.internals.StreamsMetadataState.getMetadataWithKey(StreamsMetadataState.java:155) at org.apache.kafka.streams.KafkaStreams.metadataForKey(KafkaStreams.java:1019) The cause is that the {{Cluster}} returns an empty list from {{partitionsForTopic(topic)}} and the size is then used as a divisor. The same pattern of using the size of the partitions as divisor is used in other implementations of {{Partitioner}} and also {{StickyPartitionCache}}, so presumably they're also prone to this problem when {{Cluster}} lacks information about a topic. -- This message was sent by Atlassian Jira (v8.3.4#803005)