Multiple forms causing possible EventEmitter memory leak console warning | Community
Skip to main content
April 5, 2017
Solved

Multiple forms causing possible EventEmitter memory leak console warning

  • April 5, 2017
  • 1 reply
  • 2432 views

I am working on a project that entails putting two different marketo forms on the same page.  This is resulting in the following console error:

     (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

The console trace points to marketo's form2 js file.  I have even tried removing every event listener on my end just to be sure.

Anyone have any ideas?

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

You have to link to your code.

The error is pretty accurate: a userland event management library (EventEmitter, developed I think originally by Joyent) is used by Forms2. Unlike native browser events, EE tries to be aware of when a stack limit is reached, sometimes creating unnecessary worry.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
April 5, 2017

You have to link to your code.

The error is pretty accurate: a userland event management library (EventEmitter, developed I think originally by Joyent) is used by Forms2. Unlike native browser events, EE tries to be aware of when a stack limit is reached, sometimes creating unnecessary worry.

April 7, 2017

Turned out there were too many calls to MktoForms2.whenReady().

SanfordWhiteman
New Participant
April 7, 2017

Right, you can almost always combine those event listeners (just seek the form ID in the listener).