-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
[Bug] http.IncomingMessage.destroyed
is true
after payload read since v15.5.0
#36617
Comments
notable change: - deprecate: import Chip from `common/module/RunletChip` instead of ` `common/module/Runlet` - fix: node: drop `request.destroyed` check in `node/server/Responder/Send`, error should fire for double-send, also check: nodejs/node#36617 - add: `createLockStepAsyncIter` to `common/data/Iter` - add: node: `store.socket` to `node/server/Server` - script sort - package update
Update: I added I rechecked the HTTP API doc, there's no mention of The test branch, updated CI run, and run output: test-output-update.zip And the updated main diff shows diff --git a/linux-12.txt b/linux-15.5.txt
index ff2b77d..cab1b33 100644
--- a/linux-12.txt
+++ b/linux-15.5.txt
@@ -1,71 +1,71 @@
-## TEST ENV v12.20.0 linux x64 ##
+## TEST ENV v15.5.0 linux x64 ##
## testNormalPost ##
[httpServer] created
- [httpRequest] created
[httpServer] same socket true
-[httpServer] soc/req/res.destroyed false false undefined
-[httpServer] soc/req/res.destroyed read false false undefined
+[httpServer] soc/req/res.destroyed false false false
+[httpServer] soc/req/res.destroyed read false true false
[httpServer] requestBuffer.length 320
-[httpServer] soc/req/res.destroyed wait128 false false undefined
-[httpServer] soc/req/res.destroyed end false false undefined
+[httpServer] soc/req/res.destroyed wait128 false true false
+[httpServer] soc/req/res.destroyed end false true false
- [httpRequest] same socket true
-- [httpRequest] soc/req/res.destroyed false undefined false
-- [httpRequest] soc/req/res.destroyed read false undefined false
+- [httpRequest] soc/req/res.destroyed false false false
+- [httpRequest] soc/req/res.destroyed read false false true
- [httpRequest] responseBuffer.length 320
-[httpServer] soc/req/res.destroyed close true false undefined
+[httpServer] soc/req/res.destroyed close true true true |
notable change: - deprecate: import Chip from `common/module/RunletChip` instead of ` `common/module/Runlet` - fix: node: drop `request.destroyed` check in `node/server/Responder/Send`, error should fire for double-send, also check: nodejs/node#36617 - add: `createLockStepAsyncIter` to `common/data/Iter` - add: node: `store.socket` to `node/server/Server` - add: node: `describeError` option to `node/system/Run` - script sort - package update
I think the change was introduced with #33035. cc: @nodejs/http |
cc @nodejs/streams |
I think the behavior is correct. Is this actually a problem? |
From a server point of view when:
But the underlying
This behavior change caused a concept change for me, so maybe it should be marked a break change? For me the code fix is to drop some unused Update: |
Don't use:
IMO all of them should be deprecated. Do use:
|
This has always been true since Readable was introduced. IncomingMessage is a new Readable that gets its data from the underlining socket. This matches the reality as the same socket is reused multiple times in case of keep-alive. I consider the new behavior to be less surprising given the current implementation. |
In hindsight, #33035 could have been flagged semver-major - I'm not sure it's worth a revert in v15. Note that it has already flagged to not backport it to LTS lines. |
Thanks for the explanation! Should we add some of the clarification for |
PR welcome. Feel free to close issue. |
PR added: #36641 |
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com>
Add to the history table that the `destroyed` value returns `true` after the incoming data is consumed. Refs: nodejs#36617 Refs: nodejs#33035 PR-URL: nodejs#36641 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: #36641 Refs: #36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36670 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs#36641 Refs: nodejs#36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: nodejs#36670 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: #36641 Refs: #36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36670 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: #36641 Refs: #36617 (comment) Documentation-only deprecate `.aborted` property and `'abort'`, `'aborted'` event in `http`, and suggest using the corresponding Stream API instead. Co-authored-by: Michaël Zasso <targos@protonmail.com> Co-authored-by: Rich Trott <rtrott@gmail.com> Co-authored-by: Robert Nagy <ronagy@icloud.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36670 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
What steps will reproduce the bug?
Can test with the following script: (added two more test on closing)
[test-nodejs-v15.5.0-http-stream-destroyed.js]
The GitHub Action run for 12/14/15.4/15.5 with linux/win32/darwin: https://github.com/dr-js/dr-js/actions/runs/442120897 (should last for 60 days)
The run output: test-output.zip
The main difference between 15.4 and 15.5 is: (used linux output)
How often does it reproduce? Is there a required condition?
Should always reproduce in v15.5.0.
What is the expected behavior?
No behavior change in minor release.
What do you see instead?
The issue is in Nodejs v15.5.0, the
http.IncomingMessage.destroyed
or therequest.destroyed
in serverresponse
, is settrue
as soon as the request payload is retrieved.In earlier versions, the change to
true
will not be sooner thanresponse.destroyed
.Additional information
The new behavior makes sense in some way.
But when thinking the
request
andresponse
as wrapper of the same underlyingsocket
, I think both should bedestroyed
(or not) at the same time.And
response.destroyed
isundefined
in Nodejs v12, so onlyrequest.destroyed
is checkable.For my usage, I check the
request.destroyed
in serverresponse
to see if the socket is still "alive", and this behavior change make the check pass and main logic/result get skipped.The text was updated successfully, but these errors were encountered: