apache / apache/pulsar-client-node
Exceptions like client.close/subscription.close cannot be catched
- 主要语言
- C++
- 星标
- 164
- 派生
- 98
- PR 合并指标
- 30 天内没有已合并 PR
描述
Not sure what would be better here, that either the exception should be catchable or it should be idempotent.
```javascript
const Pulsar = require("pulsar-client");
const STAGING = {
serviceUrl: "pulsar+ssl://any-server:6651",
};
async function main() {
const client = new Pulsar.Client({
...STAGING,
logLevel: Pulsar.LogLevel.ERROR,
log: (level, file, line, message) => {
console.log(`[${level}] ${file}:${line}: ${message}`);
},
});
try {
await client.close();
await client.close();
} catch (error) {
console.error("omg closing client:", error);
}
}
main();
```
```json
{
"dependencies": {
"pulsar-client": "^1.14.0"
}
}
```
Will throw
```
node error-report.js
node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: Failed to close client: AlreadyClosed]
Node.js v20.18.1
```
Even though I catched it
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先,在 Node.js 20.18.1 上使用 pulsar-client 1.14.0 重现 error-report.js 中对 client.close() 的双重调用,然后检查 client.close 和 subscription.close 的入口点,以及它们的失败如何传递到 promise。完成的标准是:该失败可以被捕获,或者重复的 close 调用能够安全地实现幂等,并且已针对所报告的示例验证行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- distributed-systems
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100