Skip to content

Request hangs up on connection destroy when parsing response stream #2105

Open
@Sourcebite

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions