Skip to content

Console.log bug: MaxListenersExceededWarning #1876

@Zoddo

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.

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