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
Fix thread not waking up when there is still data to be sent
When producing messages quickly without waiting for the future of previous
requests, there be some situations when the last batch was not sent.
That seemed to be more frequent with larger messages (~100KiB), but
apparently it could happen to any message when `linger_ms` is 0.
Not sure if it could happen when it is non-zero though.
The reason is that `BrokerConnection.send_pending_requests_v2` would
fill the internal buffer with the bytes from a request and try to send
it. If it couldn't send it completely for some reason, it would try to
send again in the next call to `send_pending_requests_v2`.
But if between those 2 calls, `BrokerConnection.send` was called, new
data would be appended to `self._protocol: KafkaProtocol`, but the
second call to `send_pending_requests_v2` wouldn't check if any new data
was available and would return False.
This would tell `KafkaClient._poll` that all pending data was sent,
which would make the client not listen to socked write readiness anymore:
https://github.com/aiven/kafka-python/blob/gqmelo/fix-sending-thread-wakeup/kafka/client_async.py#L663-L667
0 commit comments