Uh oh!
There was an error while loading. Please reload this page.
http: emit ECONNRESET if no 'aborted' listener - #28677
Conversation
8ce5c8d to
24f4a00Comparemcollina
commented
Jul 14, 2019
Would you mind adding a unit test? |
24f4a00 to
0289de3Compareronag
commented
Jul 14, 2019
@mcollina@benjamingr docs and tests added |
0289de3 to
37554a3Compareronag
commented
Jul 14, 2019
@mcollina Thank you so much for the suggestion. This would make my life much easier. |
nodejs-github-bot
commented
Jul 14, 2019
1 similar comment
mcollina
commented
Jul 14, 2019
ronag
commented
Jul 14, 2019
Hm, I have more tests to fix... |
ronag
commented
Jul 14, 2019
@mcollina May I deprecate/remove ‘aborted’ from the docs as well? Or is that a step too far? |
mcollina
commented
Jul 14, 2019
I would not deprecate/remove at this point. |
I think this is a pretty big breaking change as an |
@lpinca not having an aborted listener on the response is currently quite a serious bug... and something I believe unfortunately is quite common. Currently it will fail silently. From an API standpoint you should always have a error listener on the response object. But yes, this could be a sem major? |
lpinca
commented
Jul 14, 2019
Why? care to elaborate? |
Uh oh!
There was an error while loading. Please reload this page.
Because you would never finish... consider the following quite common pattern: awaitnewPromise((resolve,reject)=>res.on('error',reject).pipe(dst).on('error',reject).on('finish',resolve))If |
mcollina
left a comment
There was a problem hiding this comment.
Moving it to “change requested” as we need a new error code for this.
lpinca
commented
Jul 14, 2019
Hmm unconvinced, the example above is a very specific use case and I'm not very happy with enforcing either an |
37554a3 to
af06d83Compare
Fair enough. The only other argument I can give is that it pretends to be a stream but doesn't follow the stream spec (if |
af06d83 to
147e7e2Compare@mcollina: Tried a different message. |
mcollina
commented
Aug 26, 2019
@lpinca what do you think? @nodejs/tsc this is likely a significant breaking change, you might want to review again. |
nodejs-github-bot
commented
Aug 26, 2019
mcollina
commented
Aug 26, 2019
lpinca
commented
Aug 26, 2019
No strong opinion. The rationale seems sensible but I don't know if it makes sense due to the big breaking change. |
ronag
commented
Sep 18, 2019
@Trott: Is anything blocking this? |
nodejs-github-bot
commented
Sep 19, 2019
Trott
commented
Sep 19, 2019
Trott
commented
Sep 23, 2019
With this change, CITGM has new failures for ws: Details2 failing 1) WebSocket Connection establishing "after each" hook: Uncaught Error: aborted at connResetException (internal/errors.js:566:14) at Socket.socketCloseListener (_http_client.js:364:27) at TCP.<anonymous> (net.js:658:12) 2) WebSocket Connection establishing "before each" hook for "connects when pathname is not null": TypeError: Cannot read property 'call' of undefined at processImmediate (internal/timers.js:439:21)koa: Details3 failing 1) app.respond when ctx.respond === false should function (ctx): Error: aborted at connResetException (internal/errors.js:566:14) at Socket.socketCloseListener (_http_client.js:364:27) at TCP.<anonymous> (net.js:658:12) [use `--full-trace` to display the full stack trace] 2) app.respond when ctx.respond === false should ignore set header after header sent: Error: aborted at connResetException (internal/errors.js:566:14) at Socket.socketCloseListener (_http_client.js:364:27) at TCP.<anonymous> (net.js:658:12) [use `--full-trace` to display the full stack trace] 3) app.respond when ctx.respond === false should ignore set status after header sent: Error: aborted at connResetException (internal/errors.js:566:14) at Socket.socketCloseListener (_http_client.js:364:27) at TCP.<anonymous> (net.js:658:12) [use `--full-trace` to display the full stack trace] Error: mock stack null Error: ENOENT: no such file or directory, open 'does not exist' Error: ENOENT: no such file or directory, open 'does not exist' Error: ENOENT: no such file or directory, open 'does not exist' Error: ENOENT: no such file or directory, open 'does not exist' Error: ENOENT: no such file or directory, open 'does not exist' Error: boom! |
Trott
left a comment
There was a problem hiding this comment.
CITGM results would seem to indicate that we have some work to do in the ecosystem before landing this. If the approvers of this PR disagree and think it can/should land at this time, feel free to clear this review.
|
lpinca
commented
Sep 23, 2019
Yes, I don't like it but I can live with it in ws. I'm actually more worried about similar breakage this can have on the ecosystem as per #28677 (comment). I've seen a lot of code where no |
mcollina
left a comment
There was a problem hiding this comment.
Considering the breakage in the ecosystem, I don't think we should land this.
Or it just seems to work... I think a lot of the code that don't register |
I guess adding an option/flag to enable this behavior is not an option either? I find this whole A process.'warning' if aborting and neither error nor aborted is registered? @mcollina: Is there anything more that can be done here or should we close this? |
mcollina
commented
Dec 15, 2019
I would close this for now, yes |
Server requests aka. IncomingMessage emits 'aborted' instead of 'error' which causes confusion when the object is used as a regular stream, i.e. if functions working on streams are passed a server request object they might not work properly unless they take this into account. Refs: nodejs/web-server-frameworks#41 PR-URL: #33172Fixes: #28172 Refs: #28677 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Emits an ECONNRESET of response object when there is no listener for
aborted.Refs: #28172
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes