Skip to content

TypeError: '<' not supported between instances of 'ProducerBatch' and 'ProducerBatch' #2697

@ReyMagos

Description

@ReyMagos

Hey!
I encountered an error when KafkaProducer sends messages. Here is a traceback:

Traceback (most recent call last):
  File "C:\Users\reymagos\project\.venv\Lib\site-packages\kafka\producer\sender.py", line 110, in run
    self.run_once()
  File "C:\Users\reymagos\project\.venv\Lib\site-packages\kafka\producer\sender.py", line 171, in run_once
    poll_timeout_ms = self._send_producer_data()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\reymagos\project\.venv\Lib\site-packages\kafka\producer\sender.py", line 204, in _send_producer_data
    heapq.heappush(queue, item)
TypeError: '<' not supported between instances of 'ProducerBatch' and 'ProducerBatch'

It started happening after library update to 2.2.15 version but I was using 2.0.2 previously so I don't know which version exactly caused an error.
Another observation is that an error seems happening only on Windows and neither on MacOS nor Linux.
My KafkaProducer config contains nothing unusual just basic auth bootstrap servers specified.

I found temporary fix to downgrade the library or set max_in_flight_requests_per_connection=1 but will glad if problem resolves. Ready to help you with troubleshooting!

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