firebase / firebase/firebase-admin-node

Request hangs up on connection destroy when parsing response stream

Aperta
#2,105 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
api: messaging
Lingua principale
TypeScript
Stelle
1.7k
Fork
419
Merge medio
3g 10h
PR unite (30g)
16

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.