Skip to content

test: ensure finish is emitted before destroy - #33137

Closed
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:test-net-close-finish
Closed

test: ensure finish is emitted before destroy#33137
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:test-net-close-finish

Conversation

@ronag

Copy link
Copy Markdown
Member

Adds a test to ensure that 'finish' is emitted
before the socket is destroyed by allow half-open
enforcer.

Refs: 3c07b17#commitcomment-38810268

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

Adds a test to ensure that 'finish' is emitted
before the socket is destroyed by allow half-open
enforcer.
Refs: nodejs@3c07b17#commitcomment-38810268
@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Apr 28, 2020
@ronag

Copy link
Copy Markdown
MemberAuthor

review with ignore whitespace

@ronagronag added the net Issues and PRs related to the net subsystem. label Apr 28, 2020
@ronag

Copy link
Copy Markdown
MemberAuthor

This is a problem on v14. So we should backport this test together with a fix. Unfortunately the semver-major fix on master (#31806) cannot be backported.

@ronag
ronag requested a review from lpincaApril 28, 2020 21:55
socket.on('end', common.mustCall(() => {
assert(!socket.destroyed);
}));
socket.end('asd');

@ronagronagApr 29, 2020

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

calling end() here is the main difference with the previous test


{
const server = net.createServer(common.mustCall((socket) => {
socket.end(Buffer.alloc(1024));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed now that the end() is also called on the client? Shouldn't this socket be resumed to consume the data sent by the client?

@ronagronagApr 29, 2020

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure, it does trigger the bug on v14 in the current form though...

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronagronag added the review wanted PRs that need reviews. label May 4, 2020
@ronagronag mentioned this pull request May 5, 2020
4 tasks
@BridgeAR

Copy link
Copy Markdown
Member

@nodejs/streams @nodejs/http @nodejs/http2 this needs some reviews. It's open for quite a while by now.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@BridgeAR
BridgeARforce-pushed the master branch 2 times, most recently from 8ae28ff to 2935f72CompareMay 31, 2020 12:18
@jasnell

Copy link
Copy Markdown
Member

Ping @nodejs/streams

@jasnelljasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but definitely would like @mcollina's opinion

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

ronag added a commit that referenced this pull request Jun 24, 2020
Adds a test to ensure that 'finish' is emitted
before the socket is destroyed by allow half-open
enforcer.
Refs: 3c07b17#commitcomment-38810268
PR-URL: #33137
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@ronag

Copy link
Copy Markdown
MemberAuthor

Landed in 2ccf15b

@ronagronag mentioned this pull request Jul 14, 2020
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

netIssues and PRs related to the net subsystem.review wantedPRs that need reviews.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ronag@nodejs-github-bot@BridgeAR@jasnell@mcollina@lpinca@trivikr