zapty / forever-service

Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS
https://github.com/zapty/forever-service
MIT License
594 stars 65 forks source link

EventEmitter memory leak detected #30

Closed Desmodue closed 9 years ago

Desmodue commented 9 years ago

On Debian 7 when using forever-service to create startup scripts, I get the error '(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.'

This is how forever-service is called forever-service install flashconnectbridge --script bin/www -e "PATH=/usr/local/bin:\$PATH NODE_ENV=production PORT=3000" --logrotateFrequency daily -u forever-service version 0.4.6

The trace I get is

Trace at Command.addListener (events.js:179:15) at Command.option (/usr/local/lib/node_modules/forever-service/node_modules/commander/index.js:327:8) at /usr/local/lib/node_modules/forever-service/bin/forever-service:40:4 at Walker. (/usr/local/lib/node_modules/forever-service/lib/platforms.js:28:3) at Walker.emit (events.js:104:17) at Walker.doneOne (/usr/local/lib/node_modules/forever-service/node_modules/walker/lib/walker.js:109:35) at /usr/local/lib/node_modules/forever-service/node_modules/walker/lib/walker.js:99:12 at FSReqWrap.oncomplete (fs.js:95:15) Platform - Debian GNU/Linux 7 (wheezy)

commander v2.8.1, also the same error in v2.3.0 It is resolved by adding self.setMaxListeners(0); at line 213 in index.js of the node_module commander.

I can reproduce this on all of my Debian instances.

I did log this with commander but they have said I need to log it here. It may be how forever-service uses commander, not sure. Everything works just fine, more of an annoyance seeing the warnings.

Regards

Gary

arvind-agarwal commented 9 years ago

@Desmodue I am trying to figure out what I can change in forever-service to avoid this error, since change you have suggested is in commander module and I dont want to touch third party module.

arvind-agarwal commented 9 years ago

@Desmodue I have fixed the code in 0.4.7, it was because of empty option arguments I was using for formatting the description, I have now used newline characters instead and that fixes it.

Desmodue commented 9 years ago

Looks good ! No warnings now. Satisfies my OCD tendencies :)