Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Double destroy on Duplex #33335

Closed
szmarczak opened this issue May 10, 2020 · 1 comment
Closed

Double destroy on Duplex #33335

szmarczak opened this issue May 10, 2020 · 1 comment
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@szmarczak
Copy link
Member

  • 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

@ronag ronag added the stream Issues and PRs related to the stream subsystem. label May 10, 2020
@ronag
Copy link
Member

ronag commented May 10, 2020

This was fixed in v14 as a semver-major change. I don't believe it can be backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants