Skip to content

Conversation

@ronag
Copy link
Member

@ronagronag commented Mar 8, 2020

Added .destroyed property to OutgoingMessage and ClientRequest
to align with streams.

Fixed ClientRequest.destroy to dump res and re-use socket in agent
pool aligning it with abort.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Added .destroyed property to OutgoingMessage and ClientRequest to align with streams. Fixed ClientRequest.destroy to dump res and re-use socket in agent pool aligning it with abort.
@ronagronag added http Issues or PRs related to the http subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Mar 8, 2020
@ronagronag requested review from jasnell and mcollinaMarch 8, 2020 11:42
}

if(!this.aborted&&!err){
err=connResetException('socket hang up');
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, destroy() will emit ECONNRESET while abort won't.

@nodejs-github-bot
Copy link
Collaborator

@ronag

This comment has been minimized.

@ronag
Copy link
MemberAuthor

ronag commented Mar 8, 2020

After this we might want to consider deprecating abort.

@ronagronagforce-pushed the http-client-destroy4 branch 2 times, most recently from b795096 to 36a003aCompareMarch 8, 2020 12:08
@ronagronagforce-pushed the http-client-destroy4 branch from 36a003a to 54de489CompareMarch 8, 2020 12:08
@szmarczak
Copy link
Member

There are some changes needed to be made, but I'm not at home atm, will comment in an hour.

@ronag
Copy link
MemberAuthor

ronag commented Mar 8, 2020

Removed the risky change with destroyer.

@ronagronagforce-pushed the http-client-destroy4 branch from dae0286 to 88ce624CompareMarch 8, 2020 14:01
@ronag
Copy link
MemberAuthor

ronag commented Mar 8, 2020

@nodejs/web-server-frameworks

@ronagronagforce-pushed the http-client-destroy4 branch 2 times, most recently from 844adca to 97bfd14CompareMarch 8, 2020 14:21
@ronagronagforce-pushed the http-client-destroy4 branch from 97bfd14 to 0998e9bCompareMarch 8, 2020 14:21
@ronagronagforce-pushed the http-client-destroy4 branch from 92207e2 to 0245e4eCompareMarch 8, 2020 15:56
@ronagronagforce-pushed the http-client-destroy4 branch from a5199da to 6f11b24CompareMarch 8, 2020 16:59
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@szmarczakszmarczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Awesome :D

@szmarczak
Copy link
Member

szmarczak commented Mar 8, 2020

I think it's a good idea to replace

// It's possible that the socket will be destroyed, and removed from
// any messages, before ever calling this. In that case, just skip
// it, since something else is destroying this connection anyway.
IncomingMessage.prototype.destroy=functiondestroy(error){
if(this.socket)
this.socket.destroy(error);
};

with

IncomingMessage.prototype.destroy=functiondestroy(error){if(this.req)this.req.destroy(error);};

@ronag
Copy link
MemberAuthor

ronag commented Mar 8, 2020

@szmarczak See #32153 for that.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@4d93e10). Click here to learn what that means.
The diff coverage is 94.11%.

Impacted file tree graph

@@ Coverage Diff @@## master #32148 +/- ## ========================================= Coverage ? 97.04% ========================================= Files ? 197 Lines ? 65027 Branches ? 0 ========================================= Hits ? 63108 Misses ? 1919 Partials ? 0
Impacted FilesCoverage Δ
lib/wasi.js98.49% <94.11%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d93e10...f24b4a7. Read the comment docs.

@ronag
Copy link
MemberAuthor

ronag commented Mar 9, 2020

@ronagronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 10, 2020
@ronag
Copy link
MemberAuthor

@nodejs/http

@ronag
Copy link
MemberAuthor

@nodejs/tsc

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

ronag added a commit that referenced this pull request Mar 10, 2020
Added .destroyed property to OutgoingMessage and ClientRequest to align with streams. Fixed ClientRequest.destroy to dump res and re-use socket in agent pool aligning it with abort. PR-URL: #32148 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
@ronag
Copy link
MemberAuthor

Landed in 173d044

@ronagronag closed this Mar 10, 2020
@szmarczak
Copy link
Member

Will this be backported to v13.x?

@ronag
Copy link
MemberAuthor

@szmarczak Not as it is right now, it's been labeled semver-major.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.httpIssues or PRs related to the http subsystem.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@ronag@nodejs-github-bot@szmarczak@codecov-io@mcollina@addaleax