Skip to content

stream: don't flush destroyed writable#29028

Closed
ronag wants to merge 4 commits into
nodejs:masterfrom
nxtedition:stream-flush-destroýed-writable

Hidden character warning

The head ref may contain hidden characters: "stream-flush-destro\u00fded-writable"
Closed

stream: don't flush destroyed writable#29028
ronag wants to merge 4 commits into
nodejs:masterfrom
nxtedition:stream-flush-destroýed-writable

Conversation

@ronag
Copy link
Copy Markdown
Member

@ronag ronag commented Aug 6, 2019

It doesn't make much sense (and is a bit weird) to flush a stream which has been destroyed.

I need help creating a relevant test for this.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

NOTE TO SELF: Look into needFinish & stream destroyed. errorOrDestroy added in this PR should preferably be async.

@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Aug 6, 2019
@ronag ronag force-pushed the stream-flush-destroýed-writable branch 4 times, most recently from 3b3305a to 481e6d1 Compare August 6, 2019 20:20
Comment thread lib/_stream_writable.js Outdated
@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 481e6d1 to 44d3d57 Compare August 6, 2019 23:00
@jasnell jasnell requested review from mafintosh and mcollina August 7, 2019 00:26
@jasnell
Copy link
Copy Markdown
Member

jasnell commented Aug 7, 2019

Hmm.. I'm thinking this is more bug fix than breaking change. What do you think @mcollina?

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a unit test.

I'm happy to land this as a bug fix as long as it does not break anything on CITGM.

@mafintosh
Copy link
Copy Markdown
Member

def bugfix

@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 44d3d57 to 7332cb5 Compare August 7, 2019 09:50
@ronag
Copy link
Copy Markdown
Member Author

ronag commented Aug 7, 2019

test added and fixed

@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 7332cb5 to 0906aa6 Compare August 7, 2019 09:56
Comment thread lib/_stream_writable.js Outdated
@ronag ronag force-pushed the stream-flush-destroýed-writable branch 2 times, most recently from f0ea5f3 to 372588a Compare August 7, 2019 09:58
Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still consider this a bugfix, but we should:

  1. verify that CITGM passes
  2. let it bake for LTS (10.x) for some time before backporting.
Comment thread test/parallel/test-stream-write-destroy.js Outdated
@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 372588a to e1542b7 Compare August 7, 2019 12:44
@ronag
Copy link
Copy Markdown
Member Author

ronag commented Aug 7, 2019

@mcollina: Sorry, found further issues.

Consider the updated tests. We now will throw ERR_STREAM_DESTROYED on some tests that assume ERR_STREAM_WRITE_AFTER_END also we now send the err on the write callback and don't emit it as an error on the stream.

How should this be?

Copy link
Copy Markdown
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn’t mind being careful and labelling this semver-major.

Comment thread lib/_stream_writable.js Outdated
@ronag ronag force-pushed the stream-flush-destroýed-writable branch from e1542b7 to d7e8b4c Compare August 7, 2019 14:14
@ronag
Copy link
Copy Markdown
Member Author

ronag commented Aug 7, 2019

Ok, I think everything (expect @mcollina's comment on !err && chinksWritten++) is fixed in a sensical manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to the stream subsystem.

8 participants