Skip to content

Double destroy on Duplex #33335

Closed
Closed
@szmarczak

Description

@szmarczak
  • Version: v10.20.1 v12.16.3 v13.13.0
  • Platform: Linux solus 5.6.4-152.current deps: update openssl to 1.0.1j #1 SMP PREEMPT Mon Apr 20 03:18:11 UTC 2020 x86_64 GNU/Linux
  • Subsystem: stream

What steps will reproduce the bug?

const {Duplex} = require('stream');

class Example extends Duplex {
	_destroy(error, callback) {
		callback(error);
	}
}

const x = new Example();
x.destroy();
x.destroy(new Error('adsf'));

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

The error should not be thrown.

What do you see instead?

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: adsf
    at Object.<anonymous> (/home/szm/Desktop/got/bug.js:11:11)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Additional information

This is fixed starting Node.js 14.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions