Skip to content

Producer: AttributeError - 'tuple' object has no attribute 'size' #1442

Closed
@petee-d

Description

@petee-d

I've had an AttributeError - 'tuple' object has no attribute 'size' raised from producer.send in method ProducerBatch.try_append. I won't post a stack trace as I already located the primary issue:

https://github.com/dpkp/kafka-python/blob/master/kafka/record/memory_records.py#L131

MemoryRecordsBuilder.append returns None, 0 in case self._closed, but the code using this function expects the return value to be either None or some metadata object. Also the documentation of the method falsely claims the return type is (int, int), it all probably stems in unfinished refactoring.

Furthermore, I'm scared what will happen when that bug is fixed, because if it properly returns None and it gets to the following code, it will raise Exception(), which just sounds incredibly wrong, I don't think it's handled by the library.
https://github.com/dpkp/kafka-python/blob/master/kafka/producer/record_accumulator.py#L266

I'm afraid I don't have the time to make a PR with tests and also probably wouldn't have proper understanding of what I'm doing anyway.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions