GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: remove unnecessary close listener … by ronag · Pull Request #34105 · nodejs/node

Conversation

@ronag

@ronag ronag commented Jun 28, 2020

Copy link
Copy Markdown
Member

Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ronag
tls: remove unnecessary close listener
872ba51
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.
@ronag ronag added the tls Issues and PRs related to the tls subsystem. label Jun 28, 2020
@ronag
ronag requested a review from addaleax June 28, 2020 18:35
@ronag

ronag commented Jun 28, 2020

Copy link
Copy Markdown
Member Author

As a side note... there is a lot that could be improved in the tls code... However, it's kind of risky and difficult to work with. Is this something we would like to do or should I just leave it alone?

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Jun 28, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/32133/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jun 29, 2020
CI Relability 2020-06-29 JaneaSystems/nodejs-reliability#22
Open
16 tasks
@nodejs-github-bot

nodejs-github-bot commented Jun 29, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/32145/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax

addaleax commented Jun 29, 2020

Copy link
Copy Markdown
Member

As a side note... there is a lot that could be improved in the tls code... However, it's kind of risky and difficult to work with. Is this something we would like to do or should I just leave it alone?

I think it’s similar to streams – it’s hard to work with until somebody puts in a lot of work to clear it up. :/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Jun 29, 2020
View reviewed changes
@ronag ronag added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jun 29, 2020
@nodejs-github-bot

nodejs-github-bot commented Jun 29, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/32147/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jun 30, 2020
CI Relability 2020-06-30 JaneaSystems/nodejs-reliability#23
Open
17 tasks
rickyes
rickyes approved these changes Jun 30, 2020
View reviewed changes
@github-actions github-actions Bot mentioned this pull request Jul 1, 2020
CI Relability 2020-07-01 JaneaSystems/nodejs-reliability#24
Open
27 tasks
trivikr
trivikr approved these changes Jul 1, 2020
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Jul 1, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/32173/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Jul 1, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/32174/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ronag

ronag commented Jul 1, 2020

Copy link
Copy Markdown
Member Author

Landed in 60a217b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ronag ronag closed this Jul 1, 2020
ronag added a commit that referenced this pull request Jul 1, 2020
@ronag
tls: remove unnecessary close listener
60a217b
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.

PR-URL: #34105
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
This was referenced Jul 2, 2020
CI Relability 2020-07-02 JaneaSystems/nodejs-reliability#25
Open
CI Relability 2020-07-03 JaneaSystems/nodejs-reliability#26
Open
CI Relability 2020-07-04 JaneaSystems/nodejs-reliability#27
Open
This was referenced Jul 5, 2020
CI Relability 2020-07-05 JaneaSystems/nodejs-reliability#28
Open
CI Relability 2020-07-06 JaneaSystems/nodejs-reliability#29
Open
CI Relability 2020-07-07 JaneaSystems/nodejs-reliability#30
Open
CI Relability 2020-07-08 JaneaSystems/nodejs-reliability#31
Open
CI Relability 2020-07-09 JaneaSystems/nodejs-reliability#32
Open
CI Relability 2020-07-10 JaneaSystems/nodejs-reliability#33
Open
MylesBorins pushed a commit that referenced this pull request Jul 14, 2020
@ronag @MylesBorins
tls: remove unnecessary close listener
30d62c1
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.

PR-URL: #34105
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jul 14, 2020
v14.6.0 proposal #34371
Merged
MylesBorins pushed a commit that referenced this pull request Jul 16, 2020
@ronag @MylesBorins
tls: remove unnecessary close listener
fbcd1fa
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.

PR-URL: #34105
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
@ronag @addaleax
tls: remove unnecessary close listener
68654da
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.

PR-URL: #34105
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@codebytere codebytere mentioned this pull request Sep 28, 2020
v12.19.0 proposal #35401
Merged
@panmenghan

panmenghan commented Oct 10, 2020

Copy link
Copy Markdown

@ronag
This change causes the following code to crash.

const http2 = require('http2')
const net = require('net')
const {Duplex} = require('stream')

class JsSocket extends Duplex {
  constructor(socket) {
    super({autoDestroy: true, allowHalfOpen: false})
    socket.on('data', (data) => this.push(data))
    socket.on('end', (data) => this.push(null))
    socket.on('close', () => this.destroy())
    this.socket = socket
  }

  unref() {}
  ref() {}
  setNoDelay() {}
  setTimeout() {}

  _write(data, encoding, callback) {
    this.socket.write(data, encoding, callback)
  }

  _final(callback) {
    callback()
  }

  _read(size) {}

  _destroy(error, callback) {
    callback()
  }
}

const realSocket = net.connect({host: 'www.example.com', port: '443'},
  () => {
    console.log('connected')
    const connection = http2.connect('https://www.example.com', {
      socket: new JsSocket(realSocket), // crash!!!
      // socket: realSocket, // but not crash!!!
    })
    const h2Stream = connection.request({[http2.constants.HTTP2_HEADER_PATH]: '/'})
    setTimeout(() => {realSocket.destroy()}, 2e3)
    setTimeout(() => {connection.close()}, 3e3)
  }
)

output:

internal/js_stream_socket.js:210
    handle.finishWrite(req, errCode);
           ^

TypeError: Cannot read property 'finishWrite' of null
    at JSStreamSocket.finishWrite (internal/js_stream_socket.js:210:12)
    at Immediate.<anonymous> (internal/js_stream_socket.js:195:14)
    at processImmediate (internal/timers.js:461:21)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@panmenghan panmenghan mentioned this pull request Oct 21, 2020
Http2: Cannot read property 'finishWrite' of null #35695
Closed
@pimterry pimterry mentioned this pull request Aug 25, 2023
Fix a segfault by ensuring TLS Sockets are closed if the underlying stream closes #49327
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax approved these changes
@trivikr trivikr trivikr approved these changes
+1 more reviewer
@rickyes rickyes rickyes approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@ronag @nodejs-github-bot @addaleax @panmenghan @trivikr @rickyes
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.