[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting Possible EventEmitter memory leak detected on firebase functions that use google-cloud/ packages #1578

Open
jdziek opened this issue Jun 21, 2024 · 1 comment

Comments

@jdziek
Copy link
jdziek commented Jun 21, 2024

Hi.
I started getting a memory leak warning a few days ago for no apparent reason. I did update packages a few weeks ago but didn't see anything till recently. I updated the packages to the most recent ones again and still got that message.
This warning pops up whenever a function is initiated.
This is a copy of an issue I originally raised in nodejs-firestore repo but realised that this might be more related to functions, after reading the logs

image

  1. Is this a client library issue or a product issue?
    I believe this is a google-cloud package issue. I get this error, particularly in functions that must process files to storage.

  2. Did someone already solve this?
    I've seen it has been an issue in the past but nothing has been raised since then on a current release

Environment details

It happens on gen 2 firebase functions using firebase-tools@13.11.2 using nodejs 20
OtherGCPp packages that I'm using are
"@google-cloud/documentai": "^8.8.0",
"@google-cloud/firestore": "^7.8.0",
"@google-cloud/pubsub": "^4.5.0",
"@google-cloud/storage": "^7.11.2",
"firebase-admin": "^12.1.1",
"firebase-functions": "^5.0.1",

Here is a snippet of my code. The issue happens in every function that references google-cloud packages, so its not an isolated issue to this particular code, but I thought that it cant hurt including it.


import firestore from "@google-cloud/firestore";
import { InternalServerError } from "@moveready/request-errors/lib/index.js";
import envConfig from "../shared_utilities/envConfig.js";

const client = new firestore.v1.FirestoreAdminClient();

export default {
  async createDbBackup() {
    try {
      const databaseName = client.databasePath(
        envConfig.gcp.projectId,
        "(default)",
      );

      return client
        .exportDocuments({
          name: databaseName,
          outputUriPrefix: `gs://${envConfig.gcp.dbBackupBucket}`,
          collectionIds: [],
        })
        .then(([response]) => {
          logger.info(`Backup creation was successful: ${response.name}`);
          return response;
        })
        .catch((err) => {
          logger.error(err);
          throw new InternalServerError();
        });
    } catch (err) {
      logger.error(err);
      throw err;
    }
  },
};
@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

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

No branches or pull requests

2 participants