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

Ming Liu commented on KAFKA-7693:
---------------------------------

With some further debugging, the bug seems at client TransactionManager. 
incrementSequenceNumber().

Instead of

 currentSequenceNumber += increment;

as the sequenceNumber might overflow, it should 

currentSequenceNumber = 
DefaultRecordBatch.incrementSequence(currentSequenceNumber, increment);

I am preparing the pull request for the fix.

 

> "IllegalArgumentException: Invalid negative sequence number used" in Kafka 
> Client
> ---------------------------------------------------------------------------------
>
>                 Key: KAFKA-7693
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7693
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>            Reporter: Ming Liu
>            Priority: Major
>
> When operating Kafka, we have seen Kafka client logging this kind of 
> exception:
> {noformat}
> org.apache.kafka.clients.producer.internals.Sender                  -         
>                      [Producer 
> clientId=interaction-counter-service-2-dev-by-tweet-id-counting-dest-producer,
>  
> transactionalId=interaction-counter-service-2-dev-by-tweet-id-counting-81-transactional-id-gen-1]
>  Uncaught error in kafka producer I/O thread:
> java.lang.IllegalArgumentException: Invalid negative sequence number used
>     at 
> org.apache.kafka.common.record.MemoryRecordsBuilder.validateProducerState(MemoryRecordsBuilder.java:331)
>     at 
> org.apache.kafka.common.record.MemoryRecordsBuilder.close(MemoryRecordsBuilder.java:302)
>     at 
> org.apache.kafka.clients.producer.internals.ProducerBatch.close(ProducerBatch.java:407)
>     at 
> org.apache.kafka.clients.producer.internals.RecordAccumulator.drain(RecordAccumulator.java:572)
>     at 
> org.apache.kafka.clients.producer.internals.Sender.sendProducerData(Sender.java:270)
>     at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:238)
>     at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:163)
>     at java.lang.Thread.run(Thread.java:748)
> {noformat}



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

Reply via email to