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

mailgun-js is leaking memory when you require it #217

Open
shusson opened this issue Aug 27, 2018 · 1 comment
Open

mailgun-js is leaking memory when you require it #217

shusson opened this issue Aug 27, 2018 · 1 comment
Assignees

Comments

@shusson
Copy link

shusson commented Aug 27, 2018

  1. mailgun-js 0.18.0

  2. node 10.9.1

const mailgun = require("mailgun-js");

describe("mailgun-js", () => {
    it(`should not leak`, async () => {
        expect(mailgun).toBeTruthy();
    });
});
jest --detectLeaks
tests/test-leak.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

I think I narrowed it down to the dependency chain proxy-agent->agent-base. I've raised an issue TooTallNate/node-agent-base#22 to track this.

We noticed it because or jest e2e tests were failing due to running our of memory.

@bojand bojand self-assigned this Sep 10, 2018
@jimmywarting
Copy link

jimmywarting commented Sep 10, 2019

might not surprise me, just look at this dependency tree
https://npm.anvaka.com/#/view/2d/mailgun-js

If possible, remove proxy-agent, it's not mandatory, users could include a agent themselves.

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

No branches or pull requests

3 participants