Skip to content
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: deflake test-tls-js-stream #27478

Closed
wants to merge 2 commits into from

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Apr 29, 2019

socket.destroy() can destory the stream before the chunk to write
with socket.end() is actually sent. Furthermore socket.destroy()
destroys p and not the actual raw socket. As a result it is possible
that the connection is left open.

Remove socket.destroy() to ensure that the chunk is sent. Also use
common.mustCall() to ensure that the 'secureConnection' and
'secureConnect' events are emitted exactly once.

Fixes: #26938

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 29, 2019
socket.resume();
socket.destroy();
Copy link
Member Author

Choose a reason for hiding this comment

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

For reference this was added in 75930bb#diff-94e518e66d7d1b91e52af17401305431.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's placement was a deliberate regression test for destroy() in an SSL cb (specifically, from js code executed during a callback from an SSL C++ cb), so removing it loses the regression test. But, the general purpose of this test for js streams, not destroy-in-cb, and it looks like the two tests don't fit comfortably together anymore. It would be good to have a new test that triggers the old bug, but maybe at this point, with the bug fixed, we can afford to lose this line. If not, we likely need a new test specifcally for the destroy that doesn't depend on the rest of the test working.

@Trott Trott requested a review from indutny April 29, 2019 18:30
c.end('ohai');
}).listen(0, function() {
})).listen(0, function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you don't need a common.mustCall here because the server has one on connection, and that won't occur if this doesn't run, but adding one might make less reasoning about the test flow necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I didn't add it on purpose for that reason. Will fix tomorrow.

@lpinca lpinca force-pushed the deflake/test-tls-js-stream branch from 7e57c87 to 8479ef4 Compare April 30, 2019 05:09
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

`socket.destroy()` can destory the stream before the chunk to write
with `socket.end()` is actually sent. Furthermore `socket.destroy()`
destroys `p` and not the actual raw socket. As a result it is possible
that the connection is left open.

Remove `socket.destroy()` to ensure that the chunk is sent. Also use
`common.mustCall()` to ensure that the `'secureConnection'` and
`'secureConnect'` events are emitted exactly once.

Fixes: nodejs#26938
@lpinca lpinca force-pushed the deflake/test-tls-js-stream branch from 8479ef4 to c9e918b Compare May 4, 2019 07:59
@nodejs-github-bot
Copy link
Collaborator

@lpinca
Copy link
Member Author

lpinca commented May 4, 2019

Windows failures seem to be related. I will investigate.

@nodejs-github-bot
Copy link
Collaborator

@lpinca
Copy link
Member Author

lpinca commented May 4, 2019

@Trott @sam-github PTAL.

Copy link
Member

@indutny indutny left a comment

Choose a reason for hiding this comment

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

LGTM after a brief look

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

Still LGTM

@nodejs-github-bot
Copy link
Collaborator

@lpinca
Copy link
Member Author

lpinca commented May 6, 2019

Landed in 8c4bd2a.

@lpinca lpinca closed this May 6, 2019
lpinca added a commit that referenced this pull request May 6, 2019
`socket.destroy()` can destory the stream before the chunk to write
with `socket.end()` is actually sent. Furthermore `socket.destroy()`
destroys `p` and not the actual raw socket. As a result it is possible
that the connection is left open.

Remove `socket.destroy()` to ensure that the chunk is sent. Also use
`common.mustCall()` to ensure that the `'secureConnection'` and
`'secureConnect'` events are emitted exactly once.

PR-URL: #27478
Fixes: #26938
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
@lpinca lpinca deleted the deflake/test-tls-js-stream branch May 6, 2019 15:21
targos pushed a commit that referenced this pull request May 9, 2019
`socket.destroy()` can destory the stream before the chunk to write
with `socket.end()` is actually sent. Furthermore `socket.destroy()`
destroys `p` and not the actual raw socket. As a result it is possible
that the connection is left open.

Remove `socket.destroy()` to ensure that the chunk is sent. Also use
`common.mustCall()` to ensure that the `'secureConnection'` and
`'secureConnect'` events are emitted exactly once.

PR-URL: #27478
Fixes: #26938
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
@BridgeAR BridgeAR mentioned this pull request May 21, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate flaky parallel/test-tls-js-stream
5 participants