Skip to content

Conversation

@oyyd
Copy link
Contributor

@oyydoyyd commented Oct 14, 2018

When sockets of the "net" module destroyed, they will call this._handle.close() which will also emit EOF if not emitted before.

This feature makes sockets on the other side emit "end" and "close" even though we haven't called end(). As stream of StreamWrap are likely to be instances of net.Socket, calling destroy() manually will avoid issues that don't properly close wrapped connections.

Fixes: #14605

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

When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: nodejs#14605
@oyydoyyd changed the title tls: close StreamWrap and its stream correctlytls: call destroy() on StreamWrap and their streamsOct 14, 2018
Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@jasnelljasnell left a comment

Choose a reason for hiding this comment

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

@addaleaxaddaleax added tls Issues and PRs related to the tls subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Oct 21, 2018
@addaleax
Copy link
Member

Landed in 517955a, thanks for the PR again!

If you don’t see any activity on one of your PRs for a few days, feel free to ping somebody about that. :)

addaleax pushed a commit that referenced this pull request Oct 21, 2018
When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: #14605 PR-URL: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
@oyyd
Copy link
ContributorAuthor

oyyd commented Oct 21, 2018

I see. Thanks 😉

jasnell pushed a commit that referenced this pull request Oct 21, 2018
When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: #14605 PR-URL: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Nov 6, 2018
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang. PR-URL: #23866 Refs: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this pull request Nov 6, 2018
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang. PR-URL: #23866 Refs: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 26, 2018
When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: #14605 PR-URL: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
@MylesBorins
Copy link
Contributor

this lands cleanly on 10.x but has test failure on 8.x

would someone be willing to backport and figure out what is going on?

=== release test-tls-destroy-stream === Path: parallel/test-tls-destroy-stream Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Object.exports.mustCall (/Users/mborins/code/node/v8.x/test/common/index.js:439:10) at Socket.conn.once.common.mustCall (/Users/mborins/code/node/v8.x/test/parallel/test-tls-destroy-stream.js:36:35) at Socket.<anonymous> (/Users/mborins/code/node/v8.x/test/common/index.js:479:15) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Object.exports.mustCall (/Users/mborins/code/node/v8.x/test/common/index.js:439:10) at Socket.conn.once.common.mustCall (/Users/mborins/code/node/v8.x/test/parallel/test-tls-destroy-stream.js:45:35) at Socket.<anonymous> (/Users/mborins/code/node/v8.x/test/common/index.js:479:15) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) Command: out/Release/node /Users/mborins/code/node/v8.x/test/parallel/test-tls-destroy-stream.js === release test-wrap-js-stream-exceptions === Path: parallel/test-wrap-js-stream-exceptions Mismatched noop function calls. Expected exactly 1, actual 0. at Object.exports.mustCall (/Users/mborins/code/node/v8.x/test/common/index.js:439:10) at Object.<anonymous> (/Users/mborins/code/node/v8.x/test/parallel/test-wrap-js-stream-exceptions.js:13:16) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) Command: out/Release/node --expose-internals /Users/mborins/code/node/v8.x/test/parallel/test-wrap-js-stream-exceptions.js 

MylesBorins pushed a commit that referenced this pull request Nov 26, 2018
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang. PR-URL: #23866 Refs: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
@codebyterecodebytere mentioned this pull request Nov 27, 2018
rvagg pushed a commit that referenced this pull request Nov 28, 2018
When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: #14605 PR-URL: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang. PR-URL: #23866 Refs: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
When sockets of the "net" module destroyed, they will call `this._handle.close()` which will also emit EOF if not emitted before. This feature makes sockets on the other side emit "end" and "close" even though we haven't called `end()`. As `stream` of `StreamWrap` are likely to be instances of `net.Socket`, calling `destroy()` manually will avoid issues that don't properly close wrapped connections. Fixes: #14605 PR-URL: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang. PR-URL: #23866 Refs: #23654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
@codebyterecodebytere mentioned this pull request Nov 29, 2018
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.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StreamWrap doesn't properly close the wrapped connection

4 participants

@oyyd@addaleax@MylesBorins@jasnell