-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 emit drain if ended #29086
Conversation
8503eb9
to
a7d029b
Compare
@nodejs/streams |
Looks fine to me, but it would be good to have someone on @nodejs/streams vet it. Doesn't seem to have semver implications to me but there may be something subtle I'm missing? Doesn't seem like it would require benchmarking, but again, maybe I'm wrong? |
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.
LGTM with a good CITGM run
I’m good with this being a patch. |
Do you still want a CITGM run? (I'm happy to do it if we want to be extra cautious, but also happy to skip it if it's not necessary.) |
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.
Making my previous tentative LGTM more official.
Having a CITGM run would be better, yes
Il giorno sab 17 ago 2019 alle 08:43 Rich Trott <[email protected]>
ha scritto:
… ***@***.**** approved this pull request.
Making my previous tentative LGTM more official.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#29086?email_source=notifications&email_token=AAAMXY4HD7EQDW626LU4VFDQE6MXNA5CNFSM4IK4BWZKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCB3OAZQ#pullrequestreview-276226150>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAMXYZOR53HD7F4GTCUBMTQE6MXNANCNFSM4IK4BWZA>
.
|
CITGM (queued): https://ci.nodejs.org/job/citgm-smoker/1958/ |
Those CITGM results seem OK to me after a quick review. You too @mcollina? |
Extra-super-cautious second CITGM: https://ci.nodejs.org/job/citgm-smoker/1969/ |
Landed in 605d7c4 |
PR-URL: #29086 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
I was mistaken. bdf07f4 is the problem, not this commit. Original comment hidden in details.This commit is causing problems. I think it should be reverted. While the docs for As a result, Thanks for your attention. |
This comment has been minimized.
This comment has been minimized.
Thanks, we’ll revert this asap. |
@isaacs have you got a module that broke/had issue about this? I'd love to add a unit test or something to CITGM so we can avoid regressions. |
Makes sense. Is there anything I can do here to follow up? Update the docs to reflect the actual behaviour? Though I still think the behaviour of this PR is the correct one. Currently it is theoretically possible to cause an write after end in otherwise valid code. I guess we could work around that by updating the docs and also asking the user to check the |
@mcollina Run I don't have an example of it backup up a stream and causing problems that way. It'd be harder to reproduce in the wild, because it'd depend on some very specific behavior and timing, but could probably be synthetically created in a test. |
Isn't that the same issue as #29239? i.e. something else? |
@ronag It could be! The issue I saw is that I'm not sure the best way to go about getting this done, but personally, I'd really like a more massive overhaul of the streams implementation if we're talking about semver major changes. The We could improve performance and vastly simplify the codebase, with a minimal disruption to userland code, by moving to something like minipass. If streams were synchronous, and the class hierarchy rooted on a passthrough implementation (rather than squishing together Readable and Writable into Duplex), then the entire system would be much less brittle. I'm not sure the best way to go about proposing that these days, but I'd be happy to help however I can. |
@ronag Will do. I do still think this behavior change is a mistake in a minor version, so probably both need to be rolled back. |
PR-URL: #29086 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Don't emit
'drain'
if the stream has been ended.'drain'
should only be emitted if the stream wants more data.See, https://nodejs.org/api/stream.html#stream_event_drain.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesNOTE TO SELF: After this is merged look into emitting
'drain'
afterstate.length < hwm
instead ofstate.length === 0
.