firebase / firebase/firebase-admin-node

Request hangs up on connection destroy when parsing response stream

未关闭
#2,105 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: messaging
主要语言
TypeScript
星标
1.7k
派生
419
平均合并
3 天 10 小时
30 天内合并 PR
16

描述

### Environment

* Operating System version: Linux
* Firebase Admin SDK version: 11.5.0
* Firebase Product: messaging (api-request)
* Node.js version: v16.18.1
* NPM version: 8.19.2

### The problem

#### Steps to reproduce:

That error often happens under heavy load when i call multiple _messaging.sendAll_ in parallel.
Firebase server accidentally closes connection when parsing multipart response via _busboy_.
That behavior causing hanging up whole request (_messaging.sendAll_) because of ignored response error.

#### Relevant Code:

Error that happens when receiving response is ignored and not handled properly.
[src/utils/api-request.ts:489](https://github.com/firebase/firebase-admin-node/blob/master/src/utils/api-request.ts#L488)
If i add error handling to response, then i see ECONNRESET error and aborted flag on response object:

```typescript
const req: http.ClientRequest = transport.request(this.options, (res: http.IncomingMessage) => {
res.on('error', (err) => {
console.log(err);
});
this.handleResponse(res, req);
});
```

I propose to add response error handling likewise request error.

贡献指南

打开贡献指南

调研方向

从 src/utils/api-request.ts 第 489 行附近开始,将响应处理与现有的请求错误处理进行比较。如果可能,使用并行的 messaging.sendAll 调用重现该问题,然后验证诸如 ECONNRESET 之类的响应错误能够得到处理,并且请求不再挂起。

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

评估

技术栈
node.js, typescript
领域
api, backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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