You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Vikas Singh (Jira)" <ji...@apache.org> on 2020/09/28 20:02:00 UTC

[jira] [Created] (KAFKA-10531) KafkaBasedLog can sleep for negative values

Vikas Singh created KAFKA-10531:
-----------------------------------

             Summary: KafkaBasedLog can sleep for negative values
                 Key: KAFKA-10531
                 URL: https://issues.apache.org/jira/browse/KAFKA-10531
             Project: Kafka
          Issue Type: Bug
          Components: core
    Affects Versions: 2.6.0
            Reporter: Vikas Singh
             Fix For: 2.6.1


{{time.milliseconds}} is not monotonic, so this code can throw :

{{java.lang.IllegalArgumentException: timeout value is negative}}

 
{code:java}
        long started = time.milliseconds();
        while (partitionInfos == null && time.milliseconds() - started < CREATE_TOPIC_TIMEOUT_MS) {
            partitionInfos = consumer.partitionsFor(topic);
            Utils.sleep(Math.min(time.milliseconds() - started, 1000));
        }
{code}

We need to check for negative value before sleeping.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)