镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

TypeError: EventEmitter, setMaxListeners, Symbol #9003

Description

@Daeren
  • 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)

Activity

  1. added
    eventsIssues and PRs related to EventEmitter and the events module.
    good first issueIssues that are suitable for first-time contributors.
    on Oct 10, 2016
  2. removed
    good first issueIssues that are suitable for first-time contributors.
    on Oct 11, 2016
  3. polomsky commented on Apr 16, 2017

    @polomsky

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

  4. jasnell commented on Apr 16, 2017

    @jasnell
    Member

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

    Ping... @nodejs/lts

  5. gibfahn commented on Apr 16, 2017

    @gibfahn
    Member

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

  6. added 2 commits that reference this issue on Apr 18, 2017
    e760a1b
    1158f44
  7. Trott commented on Aug 2, 2017

    @Trott
    Member

    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.

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

    eventsIssues and PRs related to EventEmitter and the events module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions