-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: reset flowing state if no 'readable' or 'data' listeners. #31036
Conversation
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. Fixes: nodejs#24474
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/2150/ (queued) |
I'm not sure if resetting to |
@nodejs/streams |
A possible side effect is 'use strict';
const assert = require('assert');
const { Readable } = require('stream');
const readable = new Readable({
read() {}
});
function read() {}
readable.setEncoding('utf8');
readable.on('readable', read);
readable.removeListener('readable', read);
readable.pause();
process.nextTick(function() {
assert(readable.isPaused()); // Throws.
}); |
Good point! I've tried fixing this as well. However, now I've slightly modified the initial state of Could someone add the WIP label on this so this doesn't accidentally land until the above comment has either been ok:d or resolved? |
Tried to sort the compat issue. |
There is one legitimate test failure because
I think as is this is semver-major. |
Tried fixing that as well. |
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 as semver-major
@Trott: Can we get a CITGM? |
I think it doesn't necessarily have to be semver-major now. Could be patch. |
|
CI: https://ci.nodejs.org/job/node-test-pull-request/27935/ ✅ (one known flake on arm) |
yes, however I would tag this as “baking for lts. |
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. PR-URL: #31036 Fixes: #24474 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Landed in 3d47c85 🎉 |
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. PR-URL: #31036 Fixes: #24474 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. PR-URL: #31036 Fixes: #24474 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. PR-URL: #31036 Fixes: #24474 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state. PR-URL: #31036 Fixes: #24474 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
If we don't have any 'readable' or 'data' listeners and we are not about to resume. Then reset flowing state to initial null state.
Fixes: #24474
I don't feel very confident modifying things here but this seems to solve the issue and doesn't break any existing tests.
I would very much like a CITGM on this.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes