You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Andras Katona (JIRA)" <ji...@apache.org> on 2018/10/18 16:17:00 UTC

[jira] [Updated] (KAFKA-7518) FutureRecordMetadata.get deadline calculation from timeout is not using timeunit

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

Andras Katona updated KAFKA-7518:
---------------------------------
    Description: 
Code below assumes that timeout is in milliseconds when calculating deadline.

{code}
    @Override
    public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
        // Handle overflow.
        long now = System.currentTimeMillis();
        long deadline = Long.MAX_VALUE - timeout < now ? Long.MAX_VALUE : now + timeout;
{code}

{{kafka.server.DynamicBrokerReconfigurationTest#testAdvertisedListenerUpdate}} failed sometimes for me and it took me to this code segment.

  was:
Code below assumes that timeout is in milliseconds when calculating deadline.

{code}
    @Override
    public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
        // Handle overflow.
        long now = System.currentTimeMillis();
        long deadline = Long.MAX_VALUE - timeout < now ? Long.MAX_VALUE : now + timeout;
{code}

It was causing {{kafka.server.DynamicBrokerReconfigurationTest#testAdvertisedListenerUpdate}} to fail sometimes and it took me to this code segment.


> FutureRecordMetadata.get deadline calculation from timeout is not using timeunit
> --------------------------------------------------------------------------------
>
>                 Key: KAFKA-7518
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7518
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>            Reporter: Andras Katona
>            Assignee: Andras Katona
>            Priority: Major
>
> Code below assumes that timeout is in milliseconds when calculating deadline.
> {code}
>     @Override
>     public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
>         // Handle overflow.
>         long now = System.currentTimeMillis();
>         long deadline = Long.MAX_VALUE - timeout < now ? Long.MAX_VALUE : now + timeout;
> {code}
> {{kafka.server.DynamicBrokerReconfigurationTest#testAdvertisedListenerUpdate}} failed sometimes for me and it took me to this code segment.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)