Unhandled rejection when an in-flight certificate refresh fails after close
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- nodejs, typescript
- 领域
- backend
调研方向
从 cloud-sql-instance.js 中的内部 CloudSQLInstance 实现开始,重点关注 scheduleRefresh()、forceRefresh() 和 close()。使用 node --unhandled-rejections=strict repro.cjs 运行提供的复现用例,然后添加一个回归测试,覆盖 close 之后被拒绝的进行中 refresh。完成的标准是:refresh 的等待方在没有未处理 rejection 的情况下结束,初始设置错误仍会传递给调用方,并且进程保持运行。
由索引模型根据 Issue 内容生成。
描述
Bug Description
forceRefresh() can join an in-flight background certificate refresh. If the instance is closed and the refresh then rejects, the refresh waiter settles but Node exits with an unhandled rejection. I reproduced this with clean installs of @google-cloud/cloud-sql-connector 1.12.1 and 1.13.1.
The expected behavior is for the SDK to handle the background rejection and allow the process to continue. A caller awaiting initial connector setup should still receive any setup error.
The example exercises the internal CloudSQLInstance refresh methods with a synthetic rejection. It runs without credentials, network access, or a database connection.
Example code (or command)
const { dirname, join } = require('node:path');
const { setImmediate } = require('node:timers/promises');
const packageName = '@google-cloud/cloud-sql-connector';
const sdkDir = dirname(require.resolve(packageName));
const { CloudSQLInstance } = require(join(sdkDir, 'cloud-sql-instance.js'));
async function main() {
const instance = new CloudSQLInstance({
options: { instanceConnectionName: 'example:us-central1:example' },
});
const started = Promise.withResolvers();
const background = Promise.withResolvers();
instance.performRefresh = () => {
started.resolve();
return background.promise;
};
instance.scheduleRefresh(0);
await started.promise;
const waiter = instance.forceRefresh();
instance.close();
background.reject(new Error('Simulated Cloud SQL Admin refresh failure'));
await waiter;
console.log('Refresh waiter settled.');
await setImmediate();
console.log('Process stayed alive.');
}
main();
Stacktrace
SDK 1.12.1
Refresh waiter settled.
repro.cjs:23
background.reject(new Error('Simulated Cloud SQL Admin refresh failure'));
^
Error: Simulated Cloud SQL Admin refresh failure
at main (repro.cjs:23:21)
Node.js v24.22.1
Exit status was 1.
SDK 1.13.1
Refresh waiter settled.
repro.cjs:23
background.reject(new Error('Simulated Cloud SQL Admin refresh failure'));
^
Error: Simulated Cloud SQL Admin refresh failure
at main (repro.cjs:23:21)
Node.js v24.22.1
Exit status was 1.
How to reproduce
Environment details
- OS: macOS 27.2.1 (arm64)
- Node.js version: 24.22.1
- npm version: 11.19.1
- Connector versions:
1.12.1and1.13.1
Steps to reproduce
- In a new directory, run
npm init -yandnpm install --save-exact @google-cloud/[email protected]. - Save the example as
repro.cjs. - Run
node --unhandled-rejections=strict repro.cjs. The process exits afterRefresh waiter settled.with exit status1. - Repeat in a separate directory with
@google-cloud/[email protected].
- 主要语言
- TypeScript
- 星标
- 99
- 派生
- 18
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GoogleCloudPlatform/cloud-sql-nodejs-connector 的其他 Issue
-
flakybot: issue priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 72/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#658 ·
维护者通常 1 天内回复
-
flakybot: flaky flakybot: issue priority: p2 type: bug
难度 4/5 3-5 天 新手友好度 48/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#657 · 1 条评论 ·
维护者通常 1 天内回复
-
Cloud Build Failure Reporter: node-integration-test-nightly (cloud-sql-connector-testing) failed未关闭
难度 3/5 1-2 天 新手友好度 45/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#641 ·
维护者通常 1 天内回复
-
难度 3/5 半天 新手友好度 35/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#634 · 1 个 reaction ·
维护者通常 1 天内回复
-
flakybot: flaky flakybot: issue priority: p2 type: bug
难度 3/5 1-2 天 新手友好度 30/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#630 · 1 条评论 ·
维护者通常 1 天内回复
查看 GoogleCloudPlatform/cloud-sql-nodejs-connector 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 82/100
-
bug P3
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复