Request hangs up on connection destroy when parsing response stream #2105
Open
Description
opened on Mar 10, 2023
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
If i add error handling to response, then i see ECONNRESET error and aborted flag on response object:
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.
Activity