Skip to content

RequestTimedOutError when polling with all partitions paused #872

@hburrows

Description

@hburrows

When I pause all my partitions and call poll I get a RequestTimedOutError after 40 seconds (presumably due to request.timeout.ms). This is then shortly followed by an Auto offset commit failed for group XYZ... error. I'm pausing all my partitions so I can perform a long "batch" operation and continue to poll the topic for heartbeat purposes so Kafka doesn't think I'm dead but NOT actually fetch any messages. Once the batch operation is done I'll resume the partitions. I'm essentially trying to implement a background heartbeat by interleaving a "no-op" poll into the batch operation on a regular interval (every 2 secs)

Why am I doing this? I want to load process state from a compacted topic during process startup. I also want to use Kafka's automatic partition assignment. I use a consistent hash key for all my topics so the data in my partitions aligns from topic to topic. When a process starts it connects to a topic and gets its partition assignments. I then load state from the compacted topic by manually assigning the partitions and using the partition numbers corresponding with what was automatically assigned from the main input topic. I'll read messages from the compacted topic up to a predetermined offset and call poll on the main topic on a regular 2 sec. interval. This seems like it should work. However, after 40 secs I get RequestTimedOutError, closing connection, etc. errors.

Should this work? Why would kafka-python be trying to commit the offset for a paused partition? What would be causing the RequestTimedOutError error? Is there an alternative way that I can accomplish what I describe above (I'm more than happy to try an alternative approach).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions