Skip to content

KafkaConsumer dies with IndexError: pop from an empty deque #1371

Closed
@ghost

Description

Since updating to 1.4.0 this error started showing up after running the consumer for some seconds:

    for msg in self.consumer:
  File "/home/user/.local/lib/python2.7/site-packages/kafka/vendor/six.py", line 561, in next
    return type(self).__next__(self)
  File "/home/user/.local/lib/python2.7/site-packages/kafka/consumer/group.py", line 1117, in next
    return next(self._iterator)
  File "/home/user/.local/lib/python2.7/site-packages/kafka/consumer/group.py", line 1061, in _message_generator
    self._client.poll(timeout_ms=poll_ms)
  File "/home/user/.local/lib/python2.7/site-packages/kafka/client_async.py", line 577, in poll
    responses.extend(self._fire_pending_completed_requests())
  File "/home/user/.local/lib/python2.7/site-packages/kafka/client_async.py", line 669, in _fire_pending_completed_requests
    response, future = self._pending_completion.popleft()
IndexError: pop from an empty deque

On my test machine this happens always after a few seconds of running the consumer.
Sometimes the consumer dies completely sometimes it carries on.
From my debugging it seems that if it hits the heartbeat Thread, the consumer won't die but if it hits my mainthread it's game over.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions