[ 
https://issues.apache.org/jira/browse/KAFKA-9651?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tom Bentley reassigned KAFKA-9651:
----------------------------------

    Assignee:     (was: Tom Bentley)

> 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
>            Priority: Major
>
> 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.20.10#820010)

Reply via email to