1

I am facing the INVALID_PRODUCER_EPOCH error while committing or aborting the transaction. Am running the my application in Windows 10 machine. I have a single Producer and TransactionId is Random Guid, enabled Idempotence in producer as well. No other instance of the application or same TransactionId is used. When i try to Commit the transaction in case of successful message processing (or) Abort the transaction in case of failure while message processing i am getting the error.

I have disabled AutoCommit and AutoOffsetStore as well in the consumer settings

Below is the Debug log for the same

producerClient Transaction commit started...
%7|1655388819.918|TXNAPI|rdkafka#producer-1| [thrd:app]: Transactional API called: commit_transaction (begin) (in txn state InTransaction, idemp state Assigned)
%7|1655388819.918|TXNSTATE|rdkafka#producer-1| [thrd:main]: Transaction state change InTransaction -> BeginCommit
%7|1655388819.921|TXNCOMMIT|rdkafka#producer-1| [thrd:app]: Flushing 0 outstanding message(s) prior to commit
%7|1655388819.928|TXNCOMMIT|rdkafka#producer-1| [thrd:app]: Transaction commit message flush complete
%7|1655388819.928|TXNAPI|rdkafka#producer-1| [thrd:app]: Transactional API called: commit_transaction (in txn state BeginCommit, idemp state Assigned)
%7|1655388819.929|TXNSTATE|rdkafka#producer-1| [thrd:main]: Transaction state change BeginCommit -> CommittingTransaction
%7|1655388819.930|ENDTXN|rdkafka#producer-1| [thrd:main]: EndTxn returned INVALID_PRODUCER_EPOCH in state CommittingTransaction (may_retry=true)
%1|1655388819.930|TXNERR|rdkafka#producer-1| [thrd:main]: Fatal transaction error: Failed to end transaction: Local: This instance has been fenced by a newer instance (_FENCED)
%0|1655388819.932|FATAL|rdkafka#producer-1| [thrd:main]: Fatal error: Local: This instance has been fenced by a newer instance: Failed to end transaction: Local: This instance has been fenced by a newer instance
%7|1655388819.932|TXNSTATE|rdkafka#producer-1| [thrd:main]: Transaction state change CommittingTransaction -> FatalError
info: MyLogger[0]
      Producer Error Handler: Failed to end transaction: Local: This instance has been fenced by a newer instance
info: MyLogger[0]
      producerClient Transaction abort started...
%7|1655388834.104|TXNAPI|rdkafka#producer-1| [thrd:app]: Transactional API called: abort_transaction (begin) (in txn state FatalError, idemp state Assigned)

Any idea how to resolve this error?

  • I resolved this error. Sharing the solution it might help others who is facing this kind of error. By Increasing the TransactionTimout setting solved the issue – Vishnu Kumar K S D Jun 16 '22 at 17:26

0 Answers0