Skip to content

Conversation

@mcollina
Copy link
Member

@mcollina mcollina commented Sep 14, 2017

Refactor close() to use destroy() and not vice versa in ReadStream.
Avoid races between WriteStream.close and WriteStream.write, by aliasing close to end().

Fixes: #2006

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

fs, stream

@mcollina mcollina added dont-land-on-v6.x fs Issues and PRs related to the fs subsystem / file system. labels Sep 14, 2017
@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Sep 14, 2017
@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 14, 2017
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

@mcollina
Copy link
Member Author

I was not able to write a test for the given issue, but I am fairly certain that this solves the problem.

I am not really able to write a test to reproduce the change of behavior, which should stay fairly the same. I have flagged this as semver-major as I fear it might introduce bugs and regressions.
All our tests are passing anyhow.

A CITGM run might help.

@jasnell
Copy link
Member

jasnell commented Sep 14, 2017

Understood

@mcollina
Copy link
Member Author

@mcollina
Copy link
Member Author

I would like this to land in Node 9 if possible.

cc @nodejs/tsc for another approval as it's semver-major.

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/991/

lib/fs.js Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Should the callback really be triggered sync?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good spot. Updating.

Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: This is a private API, but it is worth testing. close() calls this. fits on one line.

@mcollina
Copy link
Member Author

mcollina commented Sep 20, 2017

Refactor close() to use destroy() and not vice versa in ReadStream.
Avoid races between WriteStream.close and WriteStream.write, by aliasing
close to end().

Fixes: nodejs#2006
@mcollina
Copy link
Member Author

Can somebody that understand what's the status on citgm verify if this is causing issues or not? It seems a lot of red in citgm is transient.

I have rebased against master.

@mcollina
Copy link
Member Author

@mcollina
Copy link
Member Author

cc @refack can you have a look?

@BridgeAR
Copy link
Member

@mcollina as far as I can read the citgm results by now I would say it is a "green" build 😆

@MylesBorins
Copy link
Contributor

@mcollina the citgm results between this PR and master don't look too far off, but I will say that there is now a huge delta between 8.x and 9.x on citgm which is a bit disturbing. Can't dig into it today but we should figure out what shifted on master to break so many things

@refack
Copy link
Contributor

refack commented Sep 20, 2017

@mcollina I didn't see anything new in CitGM
Except https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/994/nodes=ubuntu1604-64/testReport/(root)/citgm/readable_stream_v2_3_3/ 🤣 (but that's obviusly an infra issue)
There is also one thing I want to follow up on with graceful-fs @ Windows

@refack
Copy link
Contributor

refack commented Sep 20, 2017

There is also one thing I want to follow up on with graceful-fs @ Windows

graceful-fs passes localy

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

CitGM is clean

@mcollina
Copy link
Member Author

Landed as e5c290b.

@mcollina mcollina closed this Sep 21, 2017
@mcollina mcollina deleted the fs-destroy branch September 21, 2017 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing fs streams early could call close during or before I/O

7 participants