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

google-auth-library leaks memory when it is imported #525

Closed
pvatterott opened this issue Nov 5, 2018 · 2 comments
Closed

google-auth-library leaks memory when it is imported #525

pvatterott opened this issue Nov 5, 2018 · 2 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@pvatterott
Copy link

Whenever google-auth-library is imported in our codebase, our test suites start crashing with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I was able to isolate this to an issue with a downstream dependency, agent-base, which has an open issue: TooTallNate/node-agent-base#22

Environment details

  • OS: Ubuntu 18.04.1
  • Node.js version: 10.13.0
  • npm version: yarn 1.7.0
  • google-auth-library version: 2.0.0

Steps to reproduce

You can reproduce using jest --detectLeaks, like in the linked issue:

const auth = require("google-auth-library");

describe("google-auth-library", () => {
    it(`should not leak`, async () => {
        expect(auth).toBeTruthy();
    });
});
jest --detectLeaks
tests/auth-library.spec.ts
  ● Test suite failed to run

    EXPERIMENTAL FEATURE!
    Your test suite is leaking memory. Please ensure all references are cleaned.

    There is a number of things that can leak memory:
      - Async operations that have not finished (e.g. fs.readFile).
      - Timers not properly mocked (e.g. setInterval, setTimeout).
      - Keeping references to the global scope.

      at node_modules/jest-cli/build/TestScheduler.js:275:22

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.653s
@JustinBeckwith JustinBeckwith added triage me I really want to be triaged. 🚨 This issue needs some love. labels Nov 6, 2018
@JustinBeckwith JustinBeckwith added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Nov 22, 2018
@JustinBeckwith
Copy link
Contributor

Greetings! We now load https-proxy-agent only when you're specifically asking for a proxy. Unless you're doing that, hopefully this isn't a problem :)

@pvatterott
Copy link
Author

Great! That's perfect, thanks for the help

@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants