apache / apache/pulsar-client-cpp

[Bug] Acknowledge might fail with ResultAlreadyClosed during unload

未關閉
#407 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
71
分支
90
平均合併
2 小時 33 分鐘
30 天內合併 PR
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 行附近失敗的 assertion。追蹤 AckGroupingTracker 和 HandlerBase::getCnx(),以了解 unload 路徑和 retry 條件。當 client unload 時,測試通過且 ackResult 等於 ResultOk 而不是 AlreadyClosed,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp
領域
distributed-systems
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。