Skip to content

Cannot read property 'Symbol(kNativeFields)' using http2 session removeAllListeners #29457

@crystalin

Description

@crystalin
  • Version: 12.10 (12.9) but not 12.7
  • Platform: Linux and Mac (didn't try Window)

When using the removeAllListeners on a http2 stream inside an on("close"...) generates this error

TypeError: Cannot read property 'Symbol(kNativeFields)' of undefined
    at ClientHttp2Stream.streamListenerRemoved (internal/http2/core.js:453:21)
    at ClientHttp2Stream.emit (events.js:209:13)
    at ClientHttp2Stream.EventEmitter.emit (domain.js:476:20)
    at ClientHttp2Stream.removeListener (events.js:347:18)
    at ClientHttp2Stream.Readable.removeListener (_stream_readable.js:893:47)
    at ClientHttp2Stream.removeAllListeners (events.js:418:14)
    at ClientHttp2Stream.Readable.removeAllListeners (_stream_readable.js:909:51)
    at ClientHttp2Stream.removeAllListeners (events.js:407:16)
    at ClientHttp2Stream.Readable.removeAllListeners (_stream_readable.js:909:51)

The code generating it is:

... // creating http2 session and a http2 client stream
stream.on("close", () => {
  stream.removeAllListeners();

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions