markdown-pdf
markdown-pdf copied to clipboard
Possible memory leak warning
Heyho,
I just installed markdown-pdf via npm install markdown-pdf -g on my laptop, and when using it, it tells me, there is a possible memory leak:
$ markdown-pdf myMarkdown.md
(node) warning: possible EventEmitter memory leak detected. 2 end listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at SeriesStream.addListener (events.js:252:17)
at SeriesStream.Readable.on (_stream_readable.js:673:33)
at SeriesStream.on (...\npm\node_modules\markdown-pdf\node_modules\series-stream\index.js:12:38)
at SeriesStream.once (events.js:278:8)
at SeriesStream.Readable.pipe (_stream_readable.js:486:9)
at SeriesStream.pipe (...\npm\node_modules\markdown-pdf\node_modules\series-stream\index.js:22:30)
at ...\npm\node_modules\markdown-pdf\node_modules\stream-from-to\index.js:101:25
at ...\npm\node_modules\markdown-pdf\node_modules\mkdirp\index.js:47:26
at FSReqWrap.oncomplete (fs.js:82:15)
Using windows7, node 5.10.1
Output looks fine and as expected.
Same problem with Ubuntu 16.04, node 4.4.5 and markdown-pdf 7.0.0
Same problem using OS X El Capitan (10.11.5), node 6.2.2 and mardown-pdf 7.0.0
Same on Windows 10 Enterprise, version 1511, build 10586.545
This discussion might be helpful: https://github.com/nodejs/node-v0.x-archive/issues/5108 in particular the conclusion of @sam-github:
I think this should be closed. Its expected to get this warning when adding more than 11 event listeners to an emitter. You can get all the listeners from the EE and investigate what listeners were added, but unless there is evidence that node itself is leaking emitters, this is expected behaviour. Gather that evidence and reopen when if it can be found.
Hi,
For the record: I am getting the same warning on Ubuntu 16.04:
$ markdown-pdf --version
7.0.0
$ markdown-pdf README.md
(node) warning: possible EventEmitter memory leak detected. 2 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at SeriesStream.EventEmitter.addListener (events.js:160:15)
at SeriesStream.Readable.on (_stream_readable.js:689:33)
at SeriesStream.on (/usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/series-stream/index.js:12:38)
at SeriesStream.EventEmitter.once (events.js:185:8)
at SeriesStream.Readable.pipe (_stream_readable.js:474:9)
at SeriesStream.pipe (/usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/series-stream/index.js:22:30)
at /usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/index.js:101:25
at /usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/mkdirp/index.js:48:26
at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 2 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at SeriesStream.EventEmitter.addListener (events.js:160:15)
at SeriesStream.Readable.on (_stream_readable.js:689:33)
at SeriesStream.on (/usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/series-stream/index.js:12:38)
at SeriesStream.EventEmitter.once (events.js:185:8)
at ReadStream.Readable.pipe (_stream_readable.js:541:8)
at SeriesStream._next (/usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/series-stream/index.js:42:8)
at SeriesStream.pipe (/usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/series-stream/index.js:25:10)
at /usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/index.js:101:25
at /usr/local/lib/node_modules/markdown-pdf/node_modules/stream-from-to/node_modules/mkdirp/index.js:48:26
at Object.oncomplete (fs.js:107:15)
+1
More info can be found here: https://nodejs.org/api/events.html#events_eventemitter_defaultmaxlisteners
For someone who doesn't use node, how can you solve this problem?
Warning still there, but rendering is fine.
$ node -v
v8.11.1
$ markdown-pdf -V
8.1.1
Same here, when using cli
$ node -v
v8.11.4
$ markdown-pdf -V
9.0.0
same problem using WSL Ubuntu 16,04 node v9.2 or Node v9.3 on Windows
I tried adding eventEmitter.defaultMaxListeners = 400; to a bunch of files under the node_modules folder inside the markdown-pdf folder. It didn't fix it. Posting this here in case anyone is tempted to try it so that they know it isn't worth the time.
Same issue here.
node -v
v8.11.2
markdown-pdf -v
9.0.0
I did not read this issue very carefully the first time I commented.
When I saw this error message, markdown-pdf did nothing else - I didn't get any output. I don't know if that's related to this problem, but markdown-pdf does not work at all on my laptop
I had this issue with node v8.11.2 and markdown-pdf 9.0.0. But switching to node v10.13.0 solved the issue. No more error and the output generates fine.