Transactional producer's sender loops on AttributeError after a fatal error (2.2 and 2.3 branches)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- distributed-systems
Hướng nghiên cứu
Bắt đầu từ Sender.run_once trong kafka/producer/sender.py, nơi _maybe_abort_batches gọi self._accumulator.abort_batches(exc), sau đó kiểm tra kafka/producer/record_accumulator.py, nơi trên các nhánh này chỉ định nghĩa _abort_batches. Xác nhận sự không khớp bằng cách tái hiện với hai producer giao dịch dùng chung một transactional_id trên một broker. Hoàn thành khi lỗi nghiêm trọng lan truyền ra khỏi commit_transaction(), thay vì luồng I/O ghi log AttributeError rồi lặp lại. Trước tiên, hãy xác nhận maintainer chấp nhận backport lên các nhánh 2.2 và 2.3.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On the 2.2 and 2.3 branches (seen on 2.2.15, and still there in 2.2.20, 2.3.2 and the current heads of both), once a transactional producer hits a fatal error the sender thread loops forever, so commit_transaction() never returns.
Sender.run_once calls _maybe_abort_batches(last_error) when the transaction manager has a fatal error, which calls self._accumulator.abort_batches(exc) (sender.py:335 on 2.2, :343 on 2.3), but RecordAccumulator on those branches only has _abort_batches (record_accumulator.py:623 on 2.2, :473 on 2.3). So it raises AttributeError, the I/O thread catches and logs it, and goes round again:
ERROR:kafka.producer.sender:<Sender client_id=kafka-python-producer-2 transactional_id=pytx-producer>: Aborting producer batches due to fatal error: [Error 47] InvalidProducerEpochError
ERROR:kafka.producer.sender:<Sender client_id=kafka-python-producer-2 transactional_id=pytx-producer>: Uncaught error in kafka producer I/O thread
...
AttributeError: 'RecordAccumulator' object has no attribute 'abort_batches'. Did you mean: '_abort_batches'?
It seems master fixed this as part of #3010 (which renamed _abort_batches to abort_batches), so 3.0.x is fine, but the rename never made it back to 2.2 or 2.3.
To reproduce, fence a transactional producer by starting a second one with the same transactional_id, then use the first one again:
from kafka import KafkaProducer
first = KafkaProducer(bootstrap_servers=bootstrap, transactional_id="tx")
first.init_transactions()
second = KafkaProducer(bootstrap_servers=bootstrap, transactional_id="tx")
second.init_transactions()
first.begin_transaction()
first.send("topic", value=b"zombie")
first.commit_transaction() # never returns; the log fills with the AttributeError above
I'd expect commit_transaction() to raise the fatal error (InvalidProducerEpochError here, from AddPartitionsToTxn) instead. I hit this testing a Kafka-protocol gateway against kafka-python 2.2.15, where it's easy to work around, but hopefully a backport of the one-line rename (or a call to _abort_batches in sender.py) to 2.2 and 2.3 is simple enough. I'm happy to open PRs against both branches if that helps.
- Ngôn ngữ chính
- Python
- Star
- 5.9k
- Fork
- 1.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dpkp/kafka-python
-
StickyPartitionAssignor.assign() loops forever when members subscribe to different topicsCó thể đã có người làm @mstojcevich đã nhận 11 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
dpkp/kafka-python#3163 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 12/100
dpkp/kafka-python#3162 ·
-
Sender: KeyError from muted.remove() while expiring batches orphans the rest; flush() hangs foreverCó thể đã có người làm @zhechen-cs đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
dpkp/kafka-python#3159 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
dpkp/kafka-python#3122 · 13 bình luận ·
-
consumer
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
dpkp/kafka-python#3000 · 2 bình luận ·
Tất cả issue của dpkp/kafka-python
Issue tương tự
-
Use mhctools predictor_required=False for saved-result rescoringCó thể đã có người làm @iskandr đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
521xueweihan/HelloGitHub#4051 · 1 bình luận ·
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
awslabs/visual-asset-management-system#514 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend bug spec:REQ-053
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nolte/kamerplanter#2547 ·
Maintainer thường phản hồi trong vòng 1 ngày