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 行附近失败的断言。跟踪 AckGroupingTracker 和 HandlerBase::getCnx(),以了解 unload 路径和 retry 条件。当客户端 unload 时,测试应通过,并且 ackResult 等于 ResultOk 而不是 AlreadyClosed,这就表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
distributed-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。