-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test: ensure finish is emitted before destroy #33137
Conversation
Adds a test to ensure that 'finish' is emitted before the socket is destroyed by allow half-open enforcer. Refs: nodejs@3c07b17#commitcomment-38810268
review with ignore whitespace |
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. |
socket.on('end', common.mustCall(() => { | ||
assert(!socket.destroyed); | ||
})); | ||
socket.end('asd'); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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/streams @nodejs/http @nodejs/http2 this needs some reviews. It's open for quite a while by now. |
8ae28ff
to
2935f72
Compare
Ping @nodejs/streams |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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>
Landed in 2ccf15b |
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), orvcbuild test
(Windows) passes