firebase / firebase/firebase-admin-node

Request hangs up on connection destroy when parsing response stream

Đang mở
#2,105 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: messaging
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.