[ https://issues.apache.org/jira/browse/KAFKA-9765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17074688#comment-17074688 ]
Prashant Waykar commented on KAFKA-9765: ---------------------------------------- Adding logs from KafkaServer [2020-04-02 19:07:47,487] ERROR TransactionMetadata(transactionalId=TID_7273c0ee-ede7-49dc-9483-f8808bf30e4d, producerId=8007, producerEpoch=0, txnTime outMs=60000, state=CompleteCommit, pendingState=Some(Ongoing), topicPartitions=Set(), txnStartTimestamp=1585854467851, txnLastUpdateTimestamp=158585446 7858)'s transition to TxnTransitMetadata(producerId=8007, producerEpoch=0, txnTimeoutMs=60000, txnState=Ongoing, topicPartitions=Set(NetworkStretchJobs -0), txnStartTimestamp=1585854467475, txnLastUpdateTimestamp=1585854467475) failed: this should not happen (kafka.coordinator.transaction.TransactionMe tadata) [2020-04-02 19:07:47,490] ERROR [KafkaApi-0] Error when handling request: clientId=producer-9, correlationId=78, api=ADD_PARTITIONS_TO_TXN, body={trans actional_id=TID_7273c0ee-ede7-49dc-9483-f8808bf30e4d,producer_id=8007,producer_epoch=0,topics=[\{topic=NetworkStretchJobs,partitions=[0]}]} (kafka.serve r.KafkaApis) java.lang.IllegalStateException: TransactionalId TID_7273c0ee-ede7-49dc-9483-f8808bf30e4d failed transition to state TxnTransitMetadata(producerId=8007 , producerEpoch=0, txnTimeoutMs=60000, txnState=Ongoing, topicPartitions=Set(NetworkStretchJobs-0), txnStartTimestamp=1585854467475, txnLastUpdateTimes tamp=1585854467475) due to unexpected metadata at kafka.coordinator.transaction.TransactionMetadata.throwStateTransitionFailure(TransactionMetadata.scala:391) at kafka.coordinator.transaction.TransactionMetadata.completeTransitionTo(TransactionMetadata.scala:326) at kafka.coordinator.transaction.TransactionStateManager.$anonfun$appendTransactionToLog$3(TransactionStateManager.scala:541) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253) at kafka.coordinator.transaction.TransactionMetadata.inLock(TransactionMetadata.scala:172) at kafka.coordinator.transaction.TransactionStateManager.updateCacheCallback$1(TransactionStateManager.scala:533) at kafka.coordinator.transaction.TransactionStateManager.$anonfun$appendTransactionToLog$15(TransactionStateManager.scala:627) at kafka.coordinator.transaction.TransactionStateManager.$anonfun$appendTransactionToLog$15$adapted(TransactionStateManager.scala:627) at kafka.server.DelayedProduce.onComplete(DelayedProduce.scala:129) at kafka.server.DelayedOperation.forceComplete(DelayedOperation.scala:70) at kafka.server.DelayedProduce.tryComplete(DelayedProduce.scala:110) at kafka.server.DelayedOperationPurgatory.tryCompleteElseWatch(DelayedOperation.scala:248) at kafka.server.ReplicaManager.appendRecords(ReplicaManager.scala:515) at kafka.coordinator.transaction.TransactionStateManager.$anonfun$appendTransactionToLog$13(TransactionStateManager.scala:621) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253) at kafka.utils.CoreUtils$.inReadLock(CoreUtils.scala:259) at kafka.coordinator.transaction.TransactionStateManager.appendTransactionToLog(TransactionStateManager.scala:598) at kafka.coordinator.transaction.TransactionCoordinator.handleAddPartitionsToTransaction(TransactionCoordinator.scala:272) at kafka.server.KafkaApis.handleAddPartitionToTxnRequest(KafkaApis.scala:1966) at kafka.server.KafkaApis.handle(KafkaApis.scala:137) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69) at java.lang.Thread.run(Thread.java:748) > Could not add partitions to transaction due to errors > ----------------------------------------------------- > > Key: KAFKA-9765 > URL: https://issues.apache.org/jira/browse/KAFKA-9765 > Project: Kafka > Issue Type: Bug > Components: clients, producer > Affects Versions: 2.3.1 > Reporter: Prashant Waykar > Priority: Major > > I am following the producer with transactions example in > [https://kafka.apache.org/23/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html,] > and on kafkaException, I use abortTransaction and retry. > I am seeing these exceptions. Has anyone experienced this before ? Please > suggest > {code:java} > // code placeholder > java.util.concurrent.ExecutionException: > org.apache.kafka.common.KafkaException: Could not add partitions to > transaction due to errors: {nfvAlarmJob-0=UNKNOWN_SERVER_ERROR} > at > org.apache.kafka.clients.producer.internals.FutureRecordMetadata.valueOrError(FutureRecordMetadata.java:98) > at > org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:67) > at > org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:30) > at > com.vmware.vchs.hybridity.messaging.kafka.KafkaProducerDelegate.publishMessageWithTransaction(KafkaProducerDelegate.java:197) > at > com.vmware.vchs.hybridity.messaging.kafka.KafkaProducerDelegate.publish(KafkaProducerDelegate.java:164) > at > com.vmware.vchs.hybridity.messaging.kafka.KafkaProducerDelegate.publish(KafkaProducerDelegate.java:158) > at > com.vmware.vchs.hybridity.messaging.adapter.JobManagerJobPublisher.publish(JobManagerJobPublisher.java:140) > at > com.vmware.vchs.hybridity.messaging.adapter.JobManager.queueJob(JobManager.java:1720) > at > com.vmware.vchs.hybridity.messaging.adapter.JobManagementAdapter.queueJob(JobManagementAdapter.java:80) > at > com.vmware.vchs.hybridity.messaging.adapter.JobManagementAdapter.queueJob(JobManagementAdapter.java:70) > at > com.vmware.vchs.hybridity.messaging.adapter.JobManagedService.queueJob(JobManagedService.java:168) > at > com.vmware.hybridity.nfvm.alarm.UpdateVcenterAlarmsJob.run(UpdateVcenterAlarmsJob.java:67) > at > com.vmware.vchs.hybridity.messaging.LoggingJobWrapper.run(LoggingJobWrapper.java:41) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Caused by: org.apache.kafka.common.KafkaException: Could not add partitions > to transaction due to errors: {nfvAlarmJob-0=UNKNOWN_SERVER_ERROR} > at > org.apache.kafka.clients.producer.internals.TransactionManager$AddPartitionsToTxnHandler.handleResponse(TransactionManager.java:1230) > at > org.apache.kafka.clients.producer.internals.TransactionManager$TxnRequestHandler.onComplete(TransactionManager.java:1069) > at > org.apache.kafka.clients.ClientResponse.onComplete(ClientResponse.java:109) > at > org.apache.kafka.clients.NetworkClient.completeResponses(NetworkClient.java:561) > at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:553) > at > org.apache.kafka.clients.producer.internals.Sender.maybeSendAndPollTransactionalRequest(Sender.java:425) > at > org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:311) > at > org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:244) > ... 1 common frames omitted > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)