You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/03/05 11:43:00 UTC

[jira] [Commented] (KAFKA-9651) Divide by zero in DefaultPartitioner

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

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

tombentley commented on pull request #8226: KAFKA-9651: Fix ArithmeticException (รท by 0) in Partitioner impls
URL: https://github.com/apache/kafka/pull/8226
 
 
   This PR fixes KAKFA-9651 by throwing UnknownTopicOrPartitionException instead of ArithmeticException. 
 
----------------------------------------------------------------
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:
users@infra.apache.org


> 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)