Skip to content

Console.log bug: MaxListenersExceededWarning #1876

Description

@Zoddo
  • Version: v11.14.0
  • Platform: Linux zoddo 4.9.0-8-amd64 Update README for help #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux
  • Subsystem:

I got this error:

(node:7834) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:251:17)
    at WriteStream.addListener (events.js:267:10)
    at WriteStream.Readable.on (_stream_readable.js:838:35)
    at WriteStream.once (events.js:296:8)
    at Console.(anonymous function) (internal/console/constructor.js:240:12)
    at Console.log (internal/console/constructor.js:287:26)
    at Logger.log (/<snip>/src/util/Logger.js:50:13)
    at Shard.onLog (/<snip>/src/Shard.js:51:25)
    at Shard.emit (events.js:193:13)
    at Shard.EventEmitter.emit (domain.js:481:20)

I was not able to produce a simple script that reproduce this error (I don't know exactly which condition trigger this bug), but I'm able to reproduce it anytime in my code.

From what I can see on the stacktrace, the EventEmitter instance which produce this warning is internal to node. The listeners seem to be registered during a console.log() call.

Activity

  1. transferred this issue fromnodejs/nodeon Apr 20, 2019
  2. ollisal commented on Apr 25, 2019

    @ollisal

    Ditto, on Node.js v12.0.0.

  3. Zoddo commented on May 5, 2019

    @Zoddo
    Author

    I don't know why this issue was moved there. It's a bug report, not an help request.

  4. gireeshpunathil commented on May 5, 2019

    @gireeshpunathil
    Member

    @Zoddo - can you please share your test case?

  5. Zoddo commented on May 5, 2019

    @Zoddo
    Author

    As said, I'm not able to produce a simple test case (this bug is probably triggered under specific conditions). But the EventEmitter generating this error is internal to node (just take a look at the stack trace).

    Maybe @ollisal can have more chances than me, and provide a test case.

  6. zetos commented on Sep 23, 2019

    @zetos

    Had the same issue when i was using node v12.9.0 it was solved when i upgraded to node v12.10.0.

  7. gianpaj commented on Mar 29, 2020

    @gianpaj

    I'm getting this issue on OSX node v13.5.0 when running:

    npx npkill
    
    (node:11672) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [Socket]. Use emitter.setMaxListeners() to increase limitess
    
  8. PoojaDurgad commented on Sep 14, 2020

    @PoojaDurgad

    @Zoddo , is this still an issue?

  9. gireeshpunathil commented on Oct 7, 2020

    @gireeshpunathil
    Member

    inactive, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions