Open slinkydeveloper opened 1 year ago
This seems somewhat related to https://github.com/fede1024/rust-rdkafka/issues/509 and https://github.com/fede1024/rust-rdkafka/issues/453 in particular.
Apparently even disabling enable.auto.commit
and manually committing offsets blocks the drop(Consumer)
operation: https://github.com/fede1024/rust-rdkafka/issues/597#issuecomment-1733920186
I am new to rdkafka, and this issue pops up while I was trying on a minimum example of BaseConsumer.
For test purpose, I want to (1) read from earliest; (2) disable auto commit, and not commiting messages at all.
After a Ctrl-C to terminate the program, I must wait for (session.timeout.ms) seconds to re-run, or the consumer won't work. The code is here: (really simple)
As the title says, when using
enable.auto.commit
and Kafka is disconnected (e.g. kafka crashed),drop(Consumer)
will block for around the same time ofsession.timeout.ms
. Whenenable.auto.commit
is disabled, and I commit offsets synchronously, this behavior doesn't reproduce.This hangs my application for some time while shutting down.
Reproducer
I have attached a reproducer, taken from the
simple_consumer
example: simple_consumer.zip. To reproduce the behavior:my-topic
. E.g.:simple_consumer
CTRL+C
on the terminal runningsimple_consumer
You'll observe that it takes roughly the same amount of time of
session.timeout.ms
to drop the consumer.Sample logs: