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

warning: possible EventEmitter memory leak detected #48

Open
DiogoDoreto opened this issue Nov 19, 2015 · 7 comments
Open

warning: possible EventEmitter memory leak detected #48

DiogoDoreto opened this issue Nov 19, 2015 · 7 comments

Comments

@DiogoDoreto
Copy link

Hello, I'm getting the following warning when testing my app:

(node) warning: possible EventEmitter memory leak detected. 11 connection listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Server.addListener (events.js:239:17)
    at Server._listen2 ([...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\index.js:65:10)
    at listen (net.js:1270:10)
    at Server.listen (net.js:1366:5)
    at Test.serverAddress ([...]\node_modules\supertest\lib\test.js:56:33)
    at new Test ([...]\node_modules\supertest\lib\test.js:36:12)
    at Object.obj.(anonymous function) [as post] ([...]\node_modules\supertest\index.js:25:14)
    at test ([...]\test\models\userTest.js:264:10)
    at wrappedPromise.propagateAslWrapper ([...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\index.js:375:23)
    at wrappedPromise.<anonymous> ([...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\glue.js:188:31)
    at wrappedPromise.proxyWrapper [as __asl_wrapper] ([...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\index.js:382:29)
    at [...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\index.js:402:26
    at process._tickDomainCallback (node.js:411:9)
    at process.<anonymous> ([...]\node_modules\loopback\node_modules\continuation-local-storage\node_modules\async-listener\index.js:19:15)

Should the listener allocated on line 65 be deallocated in your library or this problem may come from the package that is using this library?

@nicolasgramlich
Copy link

@DiogoDoreto did you find a solution/workaround for this?

@DiogoDoreto
Copy link
Author

@nicolasgramlich No, I haven't found any. It isn't critical on my case because it isn't interfering on the results of my tests, it's just an annoying message.

@Qard
Copy link
Collaborator

Qard commented Dec 8, 2015

Both this issue and #29 are producing the same error and both have stack traces pointing to loopback and supertest. I suspect this has something to do with how loopback uses express and that breaks how supertest interacts with it. I'll have to investigate further, though I probably won't have time to look into it for a couple days.

This may also be an issue with loopback itself. If you haven't already, I'd recommend bringing this issue to their attention.

@dh376
Copy link

dh376 commented Jan 23, 2016

I also have problem with this...
I also use Loopback and it only happens when I do supertest.agent(app).
Someone really needs to figure out whats going on...
For now, I'm just not using supertest.agent and it works fine.

@eldh
Copy link

eldh commented Jan 11, 2017

Don't know if this helps anyone, but I ran into this in our app that uses continuation-local-storage and worked around it by mocking it with this mock:

export default {
  getNamespace: (name) => namespaces[name] || getNamespace(),
  createNamespace: (name) => {
    namespaces[name] = getNamespace()
    return namespaces[name]
  },
}

const getNamespace = () => ({
  get: () => {},
  set: () => {},
  run: (fn) => { fn() },
  bindEmitter: () => {},
})

const namespaces = {}

@eldh
Copy link

eldh commented Jan 11, 2017

btw I'm not using loopback.

@niftylettuce
Copy link

niftylettuce commented Aug 8, 2017

same issue here

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

6 participants