Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
fs: avoid emitting error EBADF for double close#11225
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
jasnell commented Feb 7, 2017
Given that this affects error handling it technically should be considered for semver-major. However, I think it qualifies as a bug fix so leaving it as semver-patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the / before rw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Changed the logic in fs.ReadStream and fs.WriteStream so that close always calls the prototype method rather than the internal event listener. Fixes: nodejs#2950
mcollina commented Feb 7, 2017
@jasnell I added the don't land on LTS labels, just in case. |
mscdex commented Feb 7, 2017
Minor nit: there's a typo in the commit message |
mscdex commented Feb 7, 2017
Another reason not to land on v4.x and v6.x is the use of |
evanlucas commented Feb 7, 2017
If we aren't planning on backporting this, I think we should go ahead and mark as semver-major (especially given that it seems like a breaking change) |
Fishrock123 commented Feb 8, 2017
We can just use an arrow function instead? |
mcollina commented Feb 8, 2017
If that's the only problem, yes of course. |
mcollina commented Feb 13, 2017
Landed as b1fc774 |
Changed the logic in fs.ReadStream and fs.WriteStream so that close always calls the prototype method rather than the internal event listener. Fixes: #2950 PR-URL: #11225 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
Changed the logic in fs.ReadStream and fs.WriteStream so that close always calls the prototype method rather than the internal event listener. Fixes: nodejs#2950 PR-URL: nodejs#11225 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
Fishrock123 commented Jun 1, 2017
mcollina commented Jun 2, 2017
@Fishrock123 yes. I'm happy for it to be backported, but we were not in agreement. If we agree that this is not semver-major, we can backport. I can fire a PR. |
cjihrig commented Jun 3, 2017
I don't know if this is pressing enough that it needs to be backported, but I don't feel strongly either way. |
mscdex commented Jun 3, 2017
@mcollina Now that I look at this again, I think we could have avoided the this.once('open',this.close);which is more easily backportable. Maybe submit a separate PR for the |
mcollina commented Jun 5, 2017
@mscdex we cannot, because |
mscdex commented Jun 5, 2017
@mcollina Ok well we could still pull out a reusable function and do it that way: this.once('open',closeOnOpen);// ...functioncloseOnOpen(){this.close(null);} |
mcollina commented Jun 5, 2017
here it is: #13474 |
nodejs#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: nodejs#13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
nodejs#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: nodejs#13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: #13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
Changed the logic in fs.ReadStream and fs.WriteStream so that
close always calls the prototype method rather than the internal
event listener.
Fixes: #2950
cc @evanlucas@Trott@bnoordhuis
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
fs, stream