| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
LGTM if all the added tests pass reliably.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Thinking out loud about the tests, I am wondering if this behavior could cause problems. In the first two cases res emits close after req, while in the last one is the other way around, as already pointed out. In the previous implementation, it seems that the order was always the same. |
Sorry, something went wrong.
|
I added a few more comments. |
Sorry, something went wrong.
|
I still think this behavior is ok. I would like to know a few arguments on why this is bad (minus it was a breaking change as a minor). |
Sorry, something went wrong.
My concern is with framework/libraries that might expect a strict ordering, always. I don't know if that is a good practice or not. This behavior broke hapi, but I tested fastify out of curiosity, and it didn't suffer the same issue. TLDR, I hope this doesn't complicate things too much in codebases that broke because of this change (i.e., when a fix would have to be implemented on their side). That's all I can say. I don't have a deep knowledge of hapi internals to expand more on that atm. Maybe I just got a little worried after yesterday. |
Sorry, something went wrong.
|
@cjihrig wdyt? I don't really understand how Hapi relies on this specific ordering of things. |
Sorry, something went wrong.
|
I did the analysis for hapi and can elaborate. Hapi adds a 'close' listener to the http.IncomingRequest and will terminate the response processing when this is emitted. This broke since req would suddenly close as soon as all incoming data was processed. The specific ordering of the req & res 'close' emits are irrelevant, since hapi only listens to the req event. Other frameworks are not affected because they don't take the same holistic approach that hapi does. Note that for hapi I tried to change this to listen on the 'close' event of the http.ServerResponse instead. This fixed the issue, except for an upload socket close test that is most likely wrong (it uses synthesized req / res and events). |
Sorry, something went wrong.
|
Thank you @kanongil for the analysis. It was very helpful. |
Sorry, something went wrong.
|
@kanongil could you confirm that there is no significant issue with that change shipping in Node.js v16? |
Sorry, something went wrong.
Sorry, something went wrong.
|
I can't see on https://ci.nodejs.org/ why those 3 jobs are failing, unfortunately. |
Sorry, something went wrong.
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/36645 ✔ Done loading data for nodejs/node/pull/36645 ----------------------------------- PR info ------------------------------------ Title http: add test case for req-res close ordering (#36645) Author Daniele Belardi (@dnlup) Branch dnlup:fix/regression_test_http_incoming -> nodejs:master Labels author ready, test Commits 1 - http: add test case for req-res close ordering Committers 1 - Daniele Belardi PR-URL: https://github.com/nodejs/node/pull/36645 Reviewed-By: Rich Trott Reviewed-By: Robert Nagy Reviewed-By: Matteo Collina ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/36645 Reviewed-By: Rich Trott Reviewed-By: Robert Nagy Reviewed-By: Matteo Collina -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - http: add test case for req-res close ordering ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2021-01-04T21:19:02Z: https://ci.nodejs.org/job/node-test-pull-request/35251/ - Querying data for job/node-test-pull-request/35251/ ✔ Build data downloaded ✔ Last Jenkins CI successful ℹ This PR was created on Sun, 27 Dec 2020 18:06:44 GMT ✔ Approvals: 3 ✔ - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/36645#pullrequestreview-558953069 ✔ - Robert Nagy (@ronag): https://github.com/nodejs/node/pull/36645#pullrequestreview-558953108 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/36645#pullrequestreview-558962536 -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/463731724 |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Since 55e83cb has changed the ordering of the close event, add a test case. IncomingMessage will emit close before the response is sent in case the server is consuming data from it. Refs: nodejs#33035 (comment) PR-URL: nodejs#36645 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Since 55e83cb has changed the ordering of the close event, add a test case. IncomingMessage will emit close before the response is sent in case the server is consuming data from it. Refs: #33035 (comment) PR-URL: #36645 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
| Back | FazBrowse Home | New Git URL |
Since the PR #33035 has changed the ordering of the close event, add a test case.
IncomingMessage will emit close before the response is sent in case the server is consuming data from it.
See comment #33035 (comment)
As @kanongil pointed out, IncomingMessage is emitting close before the response when the server attaches a handler to the request data event. Otherwise, the order is the same as it was before the change in the linked PR.
The test should catch eventual regressions, but let's also use this as a point for discussing this behavior further, if needed.
@ronag @mcollina
Checklist