-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Pipeline aborts all HTTP requests #32105
Comments
I'll take a look asap |
Are you able to create a self contained test case? I tried the following on const server = http.createServer((req, res) => {
setTimeout(() => {
req.write('ASDASD');
req.end();
}, 1e3);
});
server.listen(0, () => {
const req = http.request({
port: server.address().port
});
const body = new PassThrough();
pipeline(
body,
req,
common.mustCall((err) => {
assert(!err);
server.close();
})
);
body.end();
}); |
You've missed request.once('abort', common.mustNotCall); |
Ah, I think this is actually a problem with the http_client, I guess it shouldn't emit |
No, you misunderstood me. Let me explain... |
In #31940 you introduced this change: https://github.com/nodejs/node/pull/31940/files#diff-eefad5e8051f1634964a3847b691ff84R36 It calls
|
Why do you think it should not? |
|
I disagree with this. The current semantics of I might be wrong here, and it might also be a bad idea. Why do you think it shouldn't be destroyed? And if we don't call destroy how do we properly handle streams that do no properly destroy themselves? Changing this could break it in the other direction where we end up with leaking resources. |
A quick fix to resolve the break is not have a special case for |
@mcollina: I think we need your guidance here. |
@szmarczak What is the fundamental breaking change here? That the request is aborted/destroyed or that |
That the request is aborted. |
If it has completed. Why is this a problem? Aborting a completed request is basically a noop expect for the Is the problem here that only the writable side has completed when the pipeline callback is invoked and the readable side is still to be consumed? |
Well, then you should've made an exception for HTTP requests as this change makes #30869 and #31054 moot which is a major breaking change.
No, it hasn't. It has only sent the request, but it hasn't received the response yet.
Exactly! :) |
@szmarczak: Not trying to be a pain. I agree it's a breaking change. I'm just trying to understand whether this is a more fundamental problem that we've overlooked. |
Was hoping to try and sort this out quickly but I have to leave. Hopefully I'll be able to continue digging into this later tonight. Sorry for the delay. |
@mcollina: this sounds to me like we should not destroy the last stream sent to pipeline if it is (still) readable in order to allow composition. |
Sure. I think that for
You may want to write a detailed instruction in the docs about this. I see the reason behind destroying read streams, which is a good point!
I think that |
Hey all, just thinking through appropriate solutions here. Seems like the simplest thing to do would be to revert #31940. Either on master until a non breaking approach could be found, or alternatively on 13.x only and label the PR as Semver-Major and allow the behavior to land in 14.x (although that seems like kicking the can down the road). Alternatively if a fix could be found in short order we could do a release with that fix landed. In either case it would be good to get something out next week to deal with this. As an aside, we should have caught this in CITGM, it is unfortunate we didn't. Would be good to land a test with the revert / fix to ensure we don't regress here, or if we do it is very intentional. |
I believe I can have a solution that can land on both 13 and master within some hours. Not by a computer at the moment. |
13.10 breaks yarn: nodejs/node#32105
If the last stream in a pipeline is still usable/readable don't destroy it to allow further composition. Fixes: nodejs#32105
If the last stream in a pipeline is still usable/readable don't destroy it to allow further composition. Fixes: nodejs#32105 Backport-PR-URL: nodejs#32111
…lved one way or another
For those returning to this issue due to breakage in 13.10.x please see the backport PR here #32111 |
13.10 breaks yarn: nodejs/node#32105
Is there any chance to get this before 13.11.0 (#32185), in a real patch version ? I'm surprised that a major bug patch like this takes days to be published while the node ecosystem is really affected by this problem. |
@darksabrefr v13.x is not an LTS release and we explicitly have the uneven releases to detect issues like these early so that they do not get backported to the LTS release lines or only with fixes. It is not as easy as just pushing a button to publish a new release. It requires a significant amount of time to do so. The project itself is all open source and people must find the time to do so. If you would like to contribute and help out, that would be great! That aside: we have certain rules when commits may land and when not. It was almost immediately fixed after reporting it but merging requires to review the code and to wait 48 hours so that multiple collaborators get the chance to have a look at the change. Publishing a minor or a patch version will also take the same amount of time. We have lots of tests in place and try hard to guarantee stability for all changes. This is just very difficult with a complex state machine as streams. I am very grateful for the fast response from @ronag @MylesBorins and everyone else involved to make sure that a fixed version is released as soon as possible. |
@darksabrefr some extra context that might be helpful. There was another regression introduced in 13.9.0 that broke building from source tarballs. We did not get a fix in time for 13.10.0 as the releasers were not aware of the issue before pushing for the release. This in turn escalated an emegency 13.10.1 which went out last Wednesday. This issue was opened the following day, and we didn't yet have a clear solution. The earliest we could get a solution in would have been Friday, and we do our best to not do releases on Fridays, as to avoid weekend fire drills. I started working on a new 11.x release on Monday, having something basic prepared and running in CI that evening. For the current release line, as mentioned above by @BridgeAR, we include any commits that are not Semver-Minor that land cleanly on the release line. We of course work really hard to ensure that if we break thing we fix them, as you can see based on the above release going out 24 hours after the original 13.10.0, but we do not offer the same guaranteed support that we do for LTS. It is for this reason that I generally advise folks to only use LTS is production. While working on a fix for the streams bug a number of missing patches were identified that made it harder to ensure the same behavior on master and 13.x, specifically that the fix actually fixed things and could land. There we also more regressions that were identified. Multiple people have been putting in time since last Thursday to get this out, so I hope you can understand the situation is a bit complicated |
Also worth mentioning that we might be having a further delay due to an infrastructure issue in our build cluster edit: this is now resolved |
I want to thank @MylesBorins for the clarifications and @ronag and @szmarczak for the fast interventions. I just mitigate the advice to use only LTS in production. Like other people, I contribute to node, in an invisible way, by using and testing non-LTS versions days after days, on various (but not critical) real-life projects in various situations, and describing issues, here or in other related repos. @BridgeAR: code and commits are not the only maneer to contribute to a project ;-) My only reproach is the lack of communication versus this breaking bug patch release (and others related bugs that @MylesBorins mentioned too). There is no one to blame concerning the bug itself on this non-LTS channel. But a confirmed breaking bug related to an identified commit should not be reverted and immediately deployed (or asap)? I understand that's not always as simple as reverting a single commit, but that's a base idea to not let the latest stable version broken for days. A too unstable latest can lead to not have sufficient real-life tests on it, people using more LTS versions, causing backported things to LTS under-tested and potentially bugged too. |
This bug breaks hundreds of packages, including Got, Yarn and Renovate.
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
What do you see instead?
Pipeline errored: false +The request has been aborted
Additional information
This is the culprit: https://github.com/nodejs/node/pull/31940/files#diff-eefad5e8051f1634964a3847b691ff84R36
->
https://github.com/nxtedition/node/blob/5a55b1df97a1f93c5fb81bf758050d81524ae834/lib/internal/streams/destroy.js#L166
/cc @ronag
The text was updated successfully, but these errors were encountered: