firebase / firebase/firebase-admin-node

Request hangs up on connection destroy when parsing response stream

Abierto
#2,105 0 comentarios 0 reacciones 0 asignados Ver en GitHub
api: messaging
Lenguaje dominante
TypeScript
Estrellas
1.7k
Forks
419
Merge medio
3 d 10 h
PR fusionados (30 d)
16

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.