[ 
https://issues.apache.org/jira/browse/KAFKA-9651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17064959#comment-17064959
 ] 

ASF GitHub Bot commented on KAFKA-9651:
---------------------------------------

guozhangwang commented on pull request #8226: KAFKA-9651: Fix 
ArithmeticException (รท by 0) in Partitioner impls
URL: https://github.com/apache/kafka/pull/8226
 
 
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> 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
>            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.3.4#803005)

Reply via email to