You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The 'error' event can be emitted more than once when using writable.destroy() #26015
The 'error' event can be emitted multiple times when using writable.destroy() if the _destroy() callback is called asynchronously. Here is a test case:
const{ Writable }=require('stream');constwritable=newWritable({destroy(err,callback){process.nextTick(callback,newError('oops'));}});writable.on('error',console.error);writable.destroy();// Assume an internal resource is closed in the `_destroy()` implementation.// The resource fails to be closed cleanly causing `writable.destroy()` to be// called again with an error.writable.destroy(newError('error'));
Activity
lpinca commentedon Feb 9, 2019
This seems to fix the issue without breaking any existing tests
but is there a reason for having no guard at all for readable only streams?
lpinca commentedon Feb 12, 2019
cc: @nodejs/streams
mcollina commentedon Feb 12, 2019
The time needed for making it happen and dealing with the potential ecosystem breakage. If you got some stretch of time, send a PR!
mcollina commentedon Feb 12, 2019
@lpinca can you PR the changes in #26015 (comment)?
lpinca commentedon Feb 12, 2019
Yes, will do.
stream: ensure writable.destroy() emits error once
stream: ensure writable.destroy() emits error once
stream: ensure writable.destroy() emits error once
stream: ensure writable.destroy() emits error once
stream: ensure writable.destroy() emits error once
stream: ensure writable.destroy() emits error once