roccomuso / memorystore

express-session full featured MemoryStore layer without leaks!
MIT License
120 stars 20 forks source link

Memory Leaks #5

Closed Modellium closed 6 years ago

Modellium commented 6 years ago

Everytime session-express is called in the middleware. It creates a connect and a disconnect event on the store. These even add up and triggers the eventEmitter memory leak warning

I think it should be removed since it is not used by MemoryStore.

My current workaround is that I add a another middleware that does it for me.

app.use((req, res, next) => {
  req.sessionStore.removeAllListeners('connect')
  req.sessionStore.removeAllListeners('disconnect')
  next()
})

I think this should be in the library

Regards,

roccomuso commented 6 years ago

I'm not sure the issue is related to this repo. This library doesn't use or extends the EventEmitter. You should open the issue on expressjs/session.