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

Memory leak EventEmitter / chokidar #450

Closed
felixsanz opened this issue May 30, 2015 · 5 comments
Closed

Memory leak EventEmitter / chokidar #450

felixsanz opened this issue May 30, 2015 · 5 comments

Comments

@felixsanz
Copy link

Im getting sometimes lot of this errors. I don't usually get them but when i do i get like 10 in the same request. Any idea why this happens? I'm using a wrapper called koajs-nunjucks but the problem is more related to chokidar lib.

(node) warning: possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at StatWatcher.addListener (events.js:236:17)
    at Object.fs.watchFile (fs.js:1339:8)
    at EventEmitter.FSWatcher._watch (/home/developer/node1.local/node_modules/koajs-nunjucks/node_modules/nunjucks/node_modules/chokidar/index.js:251:8)
    at EventEmitter.FSWatcher._handleDir (/home/developer/node1.local/node_modules/koajs-nunjucks/node_modules/nunjucks/node_modules/chokidar/index.js:351:8)
    at /home/developer/node1.local/node_modules/koajs-nunjucks/node_modules/nunjucks/node_modules/chokidar/index.js:385:38
    at FSReqWrap.oncomplete (fs.js:78:15)
@paulmillr
Copy link
Contributor

Seems like invalid usage of chokidar.

lib.each(_this.searchPaths, function(p) {

this should be changed to chokidar.watch(paths) or similar.

@felixsanz
Copy link
Author

@paulmillr Thanks for the input.

Line L40 loops all paths and pass them to L42 -> var watcher = chokidar.watch(p);. So dunno whats going on.

Lets see what other guys say here about nunjuck usage because i'm not much familiar with it.

@jlongster
Copy link
Contributor

Thanks for the report. Are you sure you are watching multiple paths?

I wasn't aware you could pass multiple paths into chokidar, we should fix that.

@felixsanz
Copy link
Author

I'm using nunjucks on "views". My "views" folder contains .html files and also another folder called "admin" with more .html inside.

@jlongster
Copy link
Contributor

@felixsanz it should recursively watch all of that. I was asking if you were specifically passing multiple root paths to nunjucks.

Still, I'm going to fix the chokidar API call, and maybe that will help.

carljm added a commit to carljm/nunjucks that referenced this issue Sep 2, 2015
* master: (30 commits)
  Consolidate changelog.
  Catch correctly error from loaders
  Add multiline multi block raw test
  Fix "broken raw blocks test" by strictly searching for raw or endraw blocks only
  Fix multiple raw blocks with less greedy regex
  Add test for multiple raw blocks
  add maintenance note
  fix links for docs in french
  add error handler to chokidar instance (fixes mozilla#469)
  fix jshint error
  don't break in environment where Error.prototype.name can't be set (fixes mozilla#454)
  use chokidar correctly (fixes mozilla#450)
  include bin and src when using bower (fixes mozilla#444)
  fix version in browserfiles
  prep for 2.0.0
  Docs in french
  Docs : fix link
  fix docs: typo parameter caseSens
  Update web-loaders.js
  Rewrite Parser.parseRaw
  ...
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