Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: EventEmitter, setMaxListeners, Symbol #9003

Closed
Daeren opened this issue Oct 10, 2016 · 4 comments
Closed

TypeError: EventEmitter, setMaxListeners, Symbol #9003

Daeren opened this issue Oct 10, 2016 · 4 comments
Labels
events Issues and PRs related to the events subsystem / EventEmitter.

Comments

@Daeren
Copy link

Daeren commented Oct 10, 2016

  • Version: 6.7.0
  • Platform: Win 10 @ 64-bit

Expected Behavior

(node:3712) Warning: Possible EventEmitter memory leak detected.
2 Symbol("X") listeners added. Use emitter.setMaxListeners() to increase limit

Current Behavior

TypeError: Cannot convert a Symbol value to a string

Steps to Reproduce

"use strict";

const EventEmitter = require("events");

const ev    = new EventEmitter(),
      sym   = Symbol("X"); // "X";

ev
    .setMaxListeners(1)
    .on(sym, console.log)
    .on(sym, console.log)
    .emit(sym, 200);

Stack trace

events.js:260
                            `${existing.length} ${type} listeners added. ` +
                                                  ^

TypeError: Cannot convert a Symbol value to a string
    at _addListener (events.js:260:51)
    at EventEmitter.addListener (events.js:275:10)
    at Object.<anonymous> (J:\main.js:13:6)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
@vkurchatkin vkurchatkin added events Issues and PRs related to the events subsystem / EventEmitter. good first issue Issues that are suitable for first-time contributors. labels Oct 10, 2016
@addaleax addaleax removed the good first issue Issues that are suitable for first-time contributors. label Oct 11, 2016
jseagull added a commit to jseagull/node that referenced this issue Oct 12, 2016
Allows Symbol to be converted to String so it can be included in the
error.

Fixes: nodejs#9003
evanlucas pushed a commit that referenced this issue Nov 3, 2016
Allows Symbol to be converted to String so it can be included in the
error.

Fixes: #9003
PR-URL: #9021
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@polomsky
Copy link

@jasnell It is fixed in master branch but still not fixed in LTS (6.x)

@jasnell
Copy link
Member

jasnell commented Apr 16, 2017

Ok. Will have to investigate why that didn't get pulled into a release.

Ping... @nodejs/lts

@jasnell jasnell reopened this Apr 16, 2017
@gibfahn
Copy link
Member

gibfahn commented Apr 16, 2017

@jasnell looks like it needs a backport: #9021 (comment)

jseagull added a commit to jseagull/node that referenced this issue Apr 17, 2017
Allows Symbol to be converted to String so it can be included in the
error.

Fixes: nodejs#9003

Conflicts:
	lib/events.js
MylesBorins pushed a commit that referenced this issue Apr 18, 2017
Allows Symbol to be converted to String so it can be included in the
error.

Conflicts:
	lib/events.js

Fixes: #9003
Backport-PR-URL: #12459
PR-URL: #9021
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
MylesBorins pushed a commit that referenced this issue Apr 19, 2017
Allows Symbol to be converted to String so it can be included in the
error.

Conflicts:
	lib/events.js

Fixes: #9003
Backport-PR-URL: #12459
PR-URL: #9021
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@Trott
Copy link
Member

Trott commented Aug 2, 2017

It looks like the backport loanded in April. Closing. Feel free to comment or re-open if I'm wrong and this is still a thing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
events Issues and PRs related to the events subsystem / EventEmitter.
Projects
None yet
Development

No branches or pull requests

7 participants