GitHub user original-brownbear opened a pull request:

    https://github.com/apache/kafka/pull/2639

    KAFKA-3155: Avoid Long Overflow by Setting Linger to 1h instead of LONG_MAX

    This deals with https://issues.apache.org/jira/browse/KAFKA-3155
    
    This is a really trivial one :) The problem is that `Long.MaxValue` for the 
linger overflows in 
`org.apache.kafka.clients.producer.internals.RecordBatch#maybeExpire` when 
added the current timestamp like so:
    
    
![longoverflow](https://cloud.githubusercontent.com/assets/6490959/23581016/f1852054-010c-11e7-9a7f-574937b5060f.png)
    
    Then causing an error to be set for the batch by `Sender` like so (not 
happening every time since this depends on the timing of `Sender`):
    
    
![error](https://cloud.githubusercontent.com/assets/6490959/23581032/204725c2-010d-11e7-9553-0423e826e34c.png)
    
    That error then causes a call to 
`org.apache.kafka.clients.producer.internals.ProduceRequestResult#done` on the 
batch, as can be seen in the second screenshot's stacktrace ... which then 
makes the check for "not done" fail.
    
    Long story short ... trivial to fix by using 1h as linger instead of 
`Long.MaxValue` prevents the overflow and fixes the instability.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/original-brownbear/kafka KAFKA-3155

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2639.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2639
    
----
commit ddd9e5e114827e90b96d71688f438dad24b467bc
Author: Armin Braun <m...@obrown.io>
Date:   2017-03-04T17:48:04Z

    KAFKA-3155: Avoid Long Overflow by Setting Linger to 1h instead of LONG_MAX

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to