markdown-pdf icon indicating copy to clipboard operation
markdown-pdf copied to clipboard

Possible memory leak warning

Open sateffen opened this issue 9 years ago • 14 comments

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.

sateffen avatar May 30 '16 13:05 sateffen

Same problem with Ubuntu 16.04, node 4.4.5 and markdown-pdf 7.0.0

angrykoala avatar Jun 14 '16 08:06 angrykoala

Same problem using OS X El Capitan (10.11.5), node 6.2.2 and mardown-pdf 7.0.0

dulgan avatar Jul 19 '16 14:07 dulgan

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.

Tiliavir avatar Aug 17 '16 07:08 Tiliavir

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)

leon-anavi avatar Sep 18 '16 20:09 leon-anavi

+1

hckuo2 avatar Oct 14 '16 02:10 hckuo2

More info can be found here: https://nodejs.org/api/events.html#events_eventemitter_defaultmaxlisteners

sam-github avatar Oct 14 '16 03:10 sam-github

For someone who doesn't use node, how can you solve this problem?

abhigenie92 avatar Jan 14 '18 18:01 abhigenie92

Warning still there, but rendering is fine.

$ node -v
v8.11.1
$ markdown-pdf -V
8.1.1

opi avatar Apr 03 '18 08:04 opi

Same here, when using cli

  $ node -v
  v8.11.4
  $ markdown-pdf -V
  9.0.0

Bramas avatar Sep 06 '18 15:09 Bramas

same problem using WSL Ubuntu 16,04 node v9.2 or Node v9.3 on Windows

rickywu avatar Sep 25 '18 08:09 rickywu

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.

KernelDeimos avatar Jan 29 '19 02:01 KernelDeimos

Same issue here.

node -v
v8.11.2
markdown-pdf -v
9.0.0

wxrdaniel avatar Mar 21 '19 17:03 wxrdaniel

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

KernelDeimos avatar Mar 22 '19 21:03 KernelDeimos

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.

jeroenpelgrims avatar Mar 27 '19 11:03 jeroenpelgrims