dwightjack / grunt-premailer

Grunt wrapper task for Premailer
MIT License
114 stars 16 forks source link

Can't generate 'EventEmitter' error #21

Closed ValentinCreative closed 9 years ago

ValentinCreative commented 10 years ago

Hi,

when i try to generate my emails, I got this error :

Running "premailer:simple" (premailer) task
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace:
  at WriteStream.EventEmitter.addListener (events.js:160:15)
  at WriteStream.Readable.on (_stream_readable.js:689:33)
  at Socket.Stream.pipe (stream.js:65:8)
  at /Users/valentinleveque/Sites/maestro-mails/node_modules/grunt-premailer/tasks/premailer.js:132:30
  at /Users/valentinleveque/Sites/maestro-mails/node_modules/grunt-premailer/node_modules/async/lib/async.js:125:13
  at Array.forEach (native)
  at _each (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt-premailer/node_modules/async/lib/async.js:46:24)
  at Object.async.each (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt-premailer/node_modules/async/lib/async.js:124:9)
  at Object.<anonymous> (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt-premailer/tasks/premailer.js:95:15)
  at Object.<anonymous> (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/grunt/task.js:264:15)
  at Object.thisTask.fn (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/grunt/task.js:82:16)
  at Object.<anonymous> (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/util/task.js:301:30)
  at Task.runTaskFn (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/util/task.js:251:24)
  at Task.<anonymous> (/Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/util/task.js:300:12)
  at /Users/valentinleveque/Sites/maestro-mails/node_modules/grunt/lib/util/task.js:227:11
  at process._tickCallback (node.js:415:13)

And my generated file just got a doctype.

Sawtaytoes commented 10 years ago

I and having this issue myself. I have 11 HTML files, and it is having issues w/ those because it's more than 10: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

I would recommend changing the bug title to NodeJS 'EventEmitter' error because what you have makes it look like you cannot generate the error.

dennisreimann commented 9 years ago

Same here, what's the best way to avoid this?

dwightjack commented 9 years ago

Sorry for the late reply.

I switched from async.each to async.eachLimit with a limit of 10 concurrent operations. This should solve the issue.

Relevant line in code is https://github.com/dwightjack/grunt-premailer/blob/master/tasks/premailer.js#L95

Let me know if issue is fixed

Sawtaytoes commented 9 years ago

Are you saying change it on our end, build, and see if that fixes the issue then get back to you?

dwightjack commented 9 years ago

Hi,

nope. I already pushed it in a patch version. Else, if you want to give it just a try without updating you can apply the patch at your current version

nrambeck commented 8 years ago

I'm getting this same error on the latest release (0.2.13). Per the comment above, I changed the async.eachLimit concurrent operations value to 5 instead of 10 and the error went away.