You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After banging my head trying to understand why I was getting timeouts from Kafka I noticed that the timeout was on a fetch call where the offset param was exactly the last offset of the given partition.
So I went to check how KafkaEx.stream worked to see if I was doing something wrong and here is what I found out:
In the Stream implementation, there is the next_fun which:
fetches more messages from Kafka
commits them or not
calls stream_control which decides if it should continue the Stream process or not
And the issue seems to be in the order these things are done because at one moment the stream will reach the offset and this is what looks like it is happening:
try to fetch messages from the latest offset (748734 in my case)
seems like Kafka doesn't answer as it doesn't have any new message to send
Genserver times out
Maybe there should be a check before doing the fetch call if the given offset is the latest and simply not do it if so? 🤔
I don't know if this is an edge case because of a combination of timeout settings and Kafka consumer settings, if it is something related to Flow, or if this is all wrong 😆
Code and dependencies versions
I'm using:
kafka_ex from the commit 08e91caaaf2e79b676b822efedbcd90c3bbe518e (because I wanted something that was merged after the last release;
Kafka 0.11.0
Flow 0.14
My code on a high level (let me know if you want details of any part):
in the latest release 0.11 we have fixed the stream API to support the global sync_timeout setting. Perhaps you need the wait_time to be less than the sync_timeout?
Issue description
After banging my head trying to understand why I was getting timeouts from Kafka I noticed that the timeout was on a fetch call where the
offset
param was exactly the last offset of the given partition.Error:
Checking that:
Debugging
So I went to check how
KafkaEx.stream
worked to see if I was doing something wrong and here is what I found out:In the
Stream
implementation, there is the next_fun which:stream_control
which decides if it should continue theStream
process or notAnd the issue seems to be in the order these things are done because at one moment the stream will reach the offset and this is what looks like it is happening:
Maybe there should be a check before doing the fetch call if the given offset is the latest and simply not do it if so? 🤔
I don't know if this is an edge case because of a combination of timeout settings and Kafka consumer settings, if it is something related to Flow, or if this is all wrong 😆
Code and dependencies versions
I'm using:
08e91caaaf2e79b676b822efedbcd90c3bbe518e
(because I wanted something that was merged after the last release;My code on a high level (let me know if you want details of any part):
The text was updated successfully, but these errors were encountered: