Skip to content

Conversation

@addaleax
Copy link
Member

@addaleaxaddaleax commented Nov 3, 2018

@nodejs/streams @mcollina@mafintosh I’m mostly looking for feedback on the idea here rather than the implementation, i.e., does this make sense, is this the right behaviour, etc.? Also, does the test modification here mean that we might have to consider this a breaking change rather than a bugfix?


Make sure that it is safe to call the callback for _write()
even in the presence of .destroy() calls during that write.

In particular, letting the write queue continue processing would
previously have thrown an exception, because processing writes
after calling .destroy() is forbidden.

One test had to be modified to account for the fact that callbacks
for writes will now always be called, even when the stream
is destroyed during the process.

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

Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process.
@nodejs-github-botnodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Nov 3, 2018
@addaleax
Copy link
MemberAuthor

@addaleax
Copy link
MemberAuthor

addaleax commented Nov 3, 2018

Huh, apparently the test change was only necessary for an earlier version of this patch… interesting. I’m not sure I like this behavior, but on the other hand it means that this is more likely to pass as semver-patch?

New CI: https://ci.nodejs.org/job/node-test-pull-request/18319/ (:heavy_check_mark:)

@addaleax
Copy link
MemberAuthor

CITGM doesn’t seem to display any results at all…? /cc @nodejs/build-infra

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@addaleax
Copy link
MemberAuthor

addaleax commented Nov 5, 2018

@addaleax
Copy link
MemberAuthor

Any other thoughts/reviewers?

@addaleax
Copy link
MemberAuthor

Landed in d3f02d0

@addaleaxaddaleax deleted the stream-write-destroy branch November 10, 2018 21:00
addaleax added a commit to addaleax/node that referenced this pull request Nov 10, 2018
Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: nodejs#24062 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit that referenced this pull request Nov 14, 2018
Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: #24062 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
@BridgeARBridgeAR mentioned this pull request Nov 14, 2018
kiyomizumia pushed a commit to kiyomizumia/node that referenced this pull request Nov 15, 2018
Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: nodejs#24062 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
codebytere pushed a commit that referenced this pull request Dec 14, 2018
Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: #24062 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Dec 26, 2018
Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: #24062 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
@codebyterecodebytere mentioned this pull request Jan 4, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streamIssues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@addaleax@nodejs-github-bot@mcollina@jasnell