confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
7 stars 0 forks source link

Error during SendOffsetsToTransaction : Operation not valid in state Ready #2008

Open LGouellec opened 1 year ago

LGouellec commented 1 year ago

Description

Scenario :

partition.assigment.strategy = range
Offsets send in this transaction : input [[1]] @39736
dbug: Streamiz.Kafka.Net.Kafka.Internal.KafkaLoggerAdapter[0]
      stream-thread[sample-streamiz-demo-5dc30456-b375-4aef-ae00-943cad03edb0-stream-thread-0] Log producer sample-streamiz-demo-5dc30456-b375-4aef-ae00-943cad03edb0-stream-thread-0-0-1-streamiz-producer#producer-16 - [thrd:app]: Transactional API called: send_offsets_to_transaction (in txn state Ready, idemp state Assigned)
dbug: Streamiz.Kafka.Net.Kafka.Internal.KafkaLoggerAdapter[0]
      Log producer sample-streamiz-demo-5dc30456-b375-4aef-ae00-943cad03edb0-stream-thread-0-0-4-streamiz-producer#producer-19 - [thrd:main]: Querying for transaction coordinator: Coordinator query timer
dbug: Streamiz.Kafka.Net.Kafka.Internal.KafkaLoggerAdapter[0]
      Log producer sample-streamiz-demo-5dc30456-b375-4aef-ae00-943cad03edb0-stream-thread-0-0-4-streamiz-producer#producer-19 - [thrd:main]: localhost:9092/1: FindCoordinator response: Transaction coordinator is broker 1 (localhost:9092)
fail: Streamiz.Kafka.Net.Processors.StreamThread[0]
      stream-thread[sample-streamiz-demo-5dc30456-b375-4aef-ae00-943cad03edb0-stream-thread-0] Encountered the following unexpected Kafka exception during processing, this usually indicate Streams internal errors:
      Confluent.Kafka.KafkaException: Operation not valid in state Ready
         at Confluent.Kafka.Impl.SafeKafkaHandle.SendOffsetsToTransaction(IEnumerable`1 offsets, IConsumerGroupMetadata groupMetadata, Int32 millisecondsTimeout)
         at Confluent.Kafka.Producer`2.SendOffsetsToTransaction(IEnumerable`1 offsets, IConsumerGroupMetadata groupMetadata, TimeSpan timeout)

Checklist

Please provide the following information:

LGouellec commented 1 year ago

If I switch the partition assigment strategy to CooperativeSticky, I have an other error during the same phase at the same method SendOffsetsToTransaction :

 Log producer sample-streamiz-demo-28aa5c7c-e134-4e76-8758-3298b0eff6f8-stream-thread-0-0-0-streamiz-producer#producer-5 - [thrd:main]: AddOffsetsToTxn response from TxnCoordinator/1: NO_ERROR ()
dbug: Streamiz.Kafka.Net.Kafka.Internal.KafkaLoggerAdapter[0]
      Log producer sample-streamiz-demo-28aa5c7c-e134-4e76-8758-3298b0eff6f8-stream-thread-0-0-0-streamiz-producer#producer-5 - [thrd:main]: Current transaction failed in state InTransaction: Failed to commit offsets to transaction on broker localhost:9092/1: input[0](Broker: Specified group generation id is not valid) (after 214ms) (ILLEGAL_GENERATION)
dbug: Streamiz.Kafka.Net.Kafka.Internal.KafkaLoggerAdapter[0]
      Log producer sample-streamiz-demo-28aa5c7c-e134-4e76-8758-3298b0eff6f8-stream-thread-0-0-0-streamiz-producer#producer-5 - [thrd:main]: Transaction state change InTransaction -> AbortableError
stream-thread[sample-streamiz-demo-28aa5c7c-e134-4e76-8758-3298b0eff6f8-stream-thread-0] Encountered the following unexpected Kafka exception during processing, this usually indicate Streams internal errors:
Confluent.Kafka.KafkaTxnRequiresAbortException: Failed to commit offsets to transaction on broker localhost:9092/1: input[0](Broker: Specified group generation id is not valid) (after 214ms)
         at Confluent.Kafka.Impl.SafeKafkaHandle.SendOffsetsToTransaction(IEnumerable`1 offsets, IConsumerGroupMetadata groupMetadata, Int32 millisecondsTimeout)