GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — http: emit error on aborted ServerResponse by trivikr · Pull Request #63448 · nodejs/node Conversation
Member
This updates A regression test covers the case where the request socket is destroyed before Fixes: #50656 Assisted-by: openai:gpt-5.5
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsEmit an error when a ServerResponse is closed after end() but before the finish event is emitted. Fixes: nodejs#50656 Signed-off-by: Kamat, Trivikram <[email protected]> Assisted-by: openai:gpt-5.5
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Expect ECONNRESET when an HTTP response pipeline is closed before the response finish event is emitted. Update HTTP tests that intentionally close the client connection to expect ECONNRESET from ServerResponse.
|
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #63448 +/- ## ========================================== - Coverage 90.06% 90.03% -0.03% ========================================== Files 714 714 Lines 225918 225930 +12 Branches 42734 42735 +1 ========================================== - Hits 203464 203422 -42 - Misses 14232 14281 +49 - Partials 8222 8227 +5
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We need to link this up to #63249, which actively aims to match the current ServerResponse behaviour that this PR is now changing (neither erroring nor finishing if clients abort). These behaviours need to match. Do we definitely want to change this though? In the referenced issue (#50656) back in 2023, @ronag said:
But that's not generally true. There's plenty of counter-examples, most notably calling const { spawn } = require('node:child_process'); const child = spawn('node', ['-e', 'process.exit(0)']); child.stdin.on('finish', () => console.log('stdin: finish')); child.stdin.on('error', () => console.log('stdin: error')); child.stdin.on('close', () => console.log('stdin: close')); In effect, In the specific HTTP case this is a very common occurrence (clients abort responses all the time) so this will produce a lot of errors. It's good that it's guarded just for listened events, but still it'll be a very visible behavioural change and it's hard to predict the results of that. Currently, AFAICT most implementations largely happily ignore this scenario unless they're doing something expensive, and they can already detect this manually if they want to. I'm very open to exploring this more, we could certainly improve stream & HTTP client abort behaviour, but this isn't the existing invariant, and I can see arguments on it both ways so we shouldn't just accept it as given. If we really do want to change it, we should definitely change the HTTP/2 PR above before that's merged too, and then potentially look at changing lots of other Node APIs as well afterwards to try to make this invariant consistent. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Any thoughts on the above @trivikr or @ronag? #63249 is basically ready to merge, but I'm currently holding on that given the open question here about how we want these APIs to work in general. Personally, I think the current behaviour makes sense (clean abort of a writable = |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ronag Do you have any input on questions shared by @pimterry? I'd posted this PR on coming across #50656 when searching for issues which mentioned "stream" |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ok, no specific objections here, so I'm going to go ahead with #63249 for now. Happy to discuss and revisit the close-without-finish/error behaviour later on if there's appetite, but right now I do think that's our standard behaviour, and it's a reasonable solution. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
HTTP Response doesn't always emit error or finish
There was an error while loading. Please reload this page.