Feathers-vuex: Nuxt SSR has memory leak when feather-vuex is connected

Created on 4 Dec 2019  路  6Comments  路  Source: feathersjs-ecosystem/feathers-vuex

Steps to reproduce

  1. Clone this https://github.com/DreaMinder/feathers-vuex-leak-reproduction, run npm i
  2. Run npm start
  3. Run 'npm load` in separate terminal (maybe multiple times)
  4. Watch for memory usage and terminal errors

Expected behavior

Stable memory usage

Actual behavior

  1. Terminal throws error (node:10032) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 removed listeners added. Use emitter.setMaxListeners() to increase limit
  2. Memory usage increases under load and remains high while idle.
  3. When memory usage hits limit, process crashes.

System configuration

Tested on ubuntu\osx\windows.
Both feathers-vuex 1.0 and 2.0.

Fixed in next release documentation

Most helpful comment

I had the same issue but is easly fixed with disallowing events on the server:

const { makeServicePlugin, makeAuthPlugin, BaseModel, models, FeathersVuex } = feathersVuex(
  feathersClient,
  {
    serverAlias: 'api', // optional for working with multiple APIs (this is the default value)
    idField: '_id', // Must match the id field in your database table/collection
    whitelist: ['$regex', '$options'],
    enableEvents: process.client
  }
)

I was working on a documentation update but the latest version 2.3.1 broke somethings for me...

All 6 comments

In case it helps (vuex-feathers object from memory snapshot):

image

I had the same issue but is easly fixed with disallowing events on the server:

const { makeServicePlugin, makeAuthPlugin, BaseModel, models, FeathersVuex } = feathersVuex(
  feathersClient,
  {
    serverAlias: 'api', // optional for working with multiple APIs (this is the default value)
    idField: '_id', // Must match the id field in your database table/collection
    whitelist: ['$regex', '$options'],
    enableEvents: process.client
  }
)

I was working on a documentation update but the latest version 2.3.1 broke somethings for me...

@guzz sorry to hear that something broke. Could you elaborate a bit on what broke? I thought I was careful enough to not break anything, but with some more detail I can try to be more careful in the future.

Yes, thats it!

I've added this to the 3.0 docs. Will be shipping soon.

Was this page helpful?
0 / 5 - 0 ratings