Hi all! Is anyone aware of an issue related to Ka...
# troubleshooting
r
Hi all! Is anyone aware of an issue related to Kafka transactions with Flink 1.18.1 (and the Kafka 3.2.3 Client)? I have a job that has historically worked on older versions but was just recently updated to 1.18 and 3.2.3 and I’m seeing some very strange behavior. The job itself is purely Kafka-Kafka and uses EXACTLY_ONCE processing via transactions. What I’m seeing is that the job is continually checkpointing, writing to Kafka, however if I use a specific
read_committed
requirement on the consumer, it will not return or see any records. Likewise adjusting it back to
read_uncommitted
will work as expected and I can see all of the data flowing through. I have another job using the same Flink and Kafka Client version with the same transactional/processing requirements (e.g. XO) and it’s also working as expected. I’m a bit stumped and didn’t see any smoking guns that identified the specific issue or fix.
j
Hi Rion. Is it possible that the topic you’re writing to has a lingering transaction on it? If so, you might notice that any Kafka consumer with
read_committed
will only read up to the last committed transaction, and then block until the transaction completes or times out. But consumers with
read_uncommitted
will happily continue reading new data. Kafka 3.x has some new APIs and tooling that lets you introspect on transactions a bit. eg,
kafka-transactions.sh
r
So it seems that was the case, but we weren’t able to verify that. We tried recycling the brokers, recyling the jobs, adjusting the transaction prefix for the KafkaSink, etc. But nothing seemed to work. It only seemed to happen in a single environment too, and we have the same bits running in 5-6 other ones that were all fine.
I’m not sure if there would be any way to verify that historically. The job began working as expected seemingly at random after a few hours.
j
It’s definitely a bit tricky to diagnose. Using
kcat
or
kafkacat
you can set that read isolation mode, and correlate that with the overall topic offsets to see if it’s blocked or not. The kafka distribution comes with that
kafka-transaction.sh
helper now, which although very painful to use, will show if there are lingering transactions on a topic or not, and allow you to abort them.
r
I think you are on the right track though. After digging in a bit, I identified that the issue appeared shortly after noon yesterday and self-healed shortly after noon today. I realized that the transaction expiration was explicitly set to 1 day, which aligns with the theory of a hung transaction.
👍 1