paulmillr / chokidar

Minimal and efficient cross-platform file watching library
https://paulmillr.com
MIT License
11.04k stars 586 forks source link

Chokidar@3.6.0 memory leakage warning #1345

Closed Abenezer-Daniel-1 closed 2 months ago

Abenezer-Daniel-1 commented 3 months ago

I'm using chokidar@3.6.0. With Node v18.20.3.

I'm getting a memory leakage warning using a standard chokidar implementation.

My code is: watcher.on("all", () => res.write("change"));

My configuration is: module.exports = chokidar.watch(process.cwd(), { ignoreInitial: true, ignored: [ path.join(process.cwd(), "live-html-147"), path.join(process.cwd(), "node_modules") ], usePolling: false });

The full trace is: (node:1677) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 all listeners added to [FSWatcher]. Use emitter.setMaxListeners() to increase limit at _addListener (node:events:591:17) at FSWatcher.addListener (node:events:609:10) at /home/abenezer/projects/live-html/src/lib/sse.js:18:13 at Layer.handle [as handle_request] (/home/abenezer/projects/live-html/node_modules/express/lib/router/layer.js:95:5) at next (/home/abenezer/projects/live-html/node_modules/express/lib/router/route.js:149:13) at Route.dispatch (/home/abenezer/projects/live-html/node_modules/express/lib/router/route.js:119:3) at Layer.handle [as handle_request] (/home/abenezer/projects/live-html/node_modules/express/lib/router/layer.js:95:5) at /home/abenezer/projects/live-html/node_modules/express/lib/router/index.js:284:15 at Function.process_params (/home/abenezer/projects/live-html/node_modules/express/lib/router/index.js:346:12)