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

stream: don't flush destroyed writable #29028

Closed

Conversation

ronag
Copy link
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
lib/_stream_writable.js Outdated Show resolved Hide resolved
@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 481e6d1 to 44d3d57 Compare August 6, 2019 23:00
@jasnell
Copy link
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
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
Member

def bugfix

@nodejs-github-bot
Copy link
Collaborator

@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 44d3d57 to 7332cb5 Compare August 7, 2019 09:50
@ronag
Copy link
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
lib/_stream_writable.js Outdated Show resolved Hide resolved
@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
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.

test/parallel/test-stream-write-destroy.js Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

mcollina commented Aug 7, 2019

@ronag ronag force-pushed the stream-flush-destroýed-writable branch from 372588a to e1542b7 Compare August 7, 2019 12:44
@ronag
Copy link
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
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.

lib/_stream_writable.js Outdated Show resolved Hide resolved
@ronag ronag force-pushed the stream-flush-destroýed-writable branch from e1542b7 to d7e8b4c Compare August 7, 2019 14:14
@ronag
Copy link
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants