apache / apache/pulsar-client-cpp
[Bug] Acknowledge might fail with ResultAlreadyClosed during unload
- 主要言語
- C++
- スター
- 71
- フォーク
- 90
- 平均マージ
- 2時間 33分
- マージ済み PR(30日)
- 3
説明
### 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!
コントリビューションガイド
調査の方向性
tests/extensibleLM/ExtensibleLoadManagerTest.cc から始め、特に ackReceipt のセットアップと 147 行目付近で失敗しているアサーションを確認してください。AckGroupingTracker と HandlerBase::getCnx() を追跡して、unload パスと retry 条件を理解してください。クライアントが unload したときに、ackResult が AlreadyClosed ではなく ResultOk と等しくなってテストが通れば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- distributed-systems
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100