apache / apache/pulsar-client-cpp
[Bug] Acknowledge might fail with ResultAlreadyClosed during unload
- Ngôn ngữ chính
- C++
- Star
- 71
- Fork
- 90
- Merge trung bình
- 2 giờ 33 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing similar.
### Version
main
### Minimal reproduce step
Enable `ackReceipt` for https://github.com/apache/pulsar-client-cpp/blob/main/tests/extensibleLM/ExtensibleLoadManagerTest.cc
```c++
ConsumerConfiguration consumerConf;
consumerConf.setAckReceiptEnabled(true);
Consumer consumer;
Result consumerResult = client.subscribe(topicName, "sub", consumerConf, consumer);
```
### What did you expect to see?
The test passed
### What did you see instead?
```
2024-02-27 21:51:30.938 WARN [0x16b36b000] AckGroupingTracker:93 | Connection is not ready, ACK failed for [(14,0,-1,-1)]
2024-02-27 21:51:30.938 INFO [0x16b96f000] ExtensibleLoadManagerTest:145 | acked i: 0 81 ms
/Users/xuyunze/github.com/bewaremypower/pulsar-client-cpp/tests/extensibleLM/ExtensibleLoadManagerTest.cc:147: Failure
Expected equality of these values:
ackResult
Which is: AlreadyClosed
ResultOk
Which is: Ok
```
Note: I changed the log level of `AckGroupingTracker:93` to warn locally.
### Anything else?
When `HandlerBase::getCnx()` returns a null `weak_ptr`, it's retryable if the state is not `Closing` or `Closed`. We should schedule the flush again.
### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với tests/extensibleLM/ExtensibleLoadManagerTest.cc, đặc biệt là phần thiết lập ackReceipt và assertion bị lỗi quanh dòng 147. Theo dõi AckGroupingTracker và HandlerBase::getCnx() để hiểu đường dẫn unload và điều kiện retry. Hoàn tất khi test chạy thành công với ackResult bằng ResultOk thay vì AlreadyClosed khi client unload.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- distributed-systems
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100