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 — https: fix connection checking interval not clearing on server close by Linkgoron · Pull Request #48383 · nodejs/node

Conversation

@Linkgoron

@Linkgoron Linkgoron commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

The connection checking interval should get cleared when https.Server.close is called similarly to how it gets cleared when http.Server.close is called. Note that this also adds a call to closeIdleConnections() to https.server.close.

Fixes #48373

Sorry, something went wrong.

Uh oh!

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

bricss and btoueg reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@Linkgoron
https: fix connection checking interval not clearing on server close
af60e03
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: nodejs#48373
@Linkgoron
Linkgoron requested a review from ShogunPanda June 7, 2023 19:35
@nodejs-github-bot

nodejs-github-bot commented Jun 7, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/http
  • @nodejs/net
All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot added http Issues and PRs related to the http subsystem. https Issues and PRs related to the https subsystem. needs-ci PRs that need a full CI run. labels Jun 7, 2023
marco-ippolito
marco-ippolito reviewed Jun 7, 2023
View reviewed changes

@marco-ippolito marco-ippolito left a comment

Copy link
Copy Markdown
Member

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.

I'm not confident approving this without a test

Sorry, something went wrong.

Uh oh!

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

All reactions
@Linkgoron

Linkgoron commented Jun 7, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

I'm not confident approving this without a test

I looked and couldn't find any tests for this specific server.close behavior. Obviously, this doesn't mean that they don't exist - If you know where they exist, or can give me some pointers on how to test this for http and https, I'd be happy to port or write them. If you have any other fears of breakage (e.g. because close is now on https.Server instead of tls.Server) I'd be happy to add any test that is missing as well.

The original intention that was approved here was to add it to https as well, but it was just an oversight that https.Server.close doesn't actually call http.Server.close.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mscdex

mscdex commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

Shouldn't it be possible to write a minimal test based on the code in the original issue?

All reactions

Sorry, something went wrong.

Uh oh!

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

@Linkgoron

Linkgoron commented Jun 7, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

Shouldn't it be possible to write a minimal test based on the code in the original issue?

I assumed that the question was something more functional than that. If it's just adding a test to check that the timer was cleared, it's not very difficult to check (The test would know some internals, as the timer hides behind a symbol so we'd need to expose it, but IMO it's not that bad).

All reactions

Sorry, something went wrong.

Uh oh!

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

@ShogunPanda

ShogunPanda commented Jun 8, 2023

Copy link
Copy Markdown
Contributor

I second @marco-ippolito. Code changes look fine but we need tests, thanks :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@Linkgoron
fixup! https: fix connection checking interval not clearing on server…
d54d2aa
… close
@Linkgoron

Linkgoron commented Jun 8, 2023

Copy link
Copy Markdown
Contributor Author

added tests as requested, note that I also changed an existing test as the call to closeIdleConnections is redundant because close already calls closeIdleConnections.

All reactions

Sorry, something went wrong.

Uh oh!

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

MoLow
MoLow approved these changes Jun 8, 2023
View reviewed changes

@MoLow MoLow left a comment

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

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

Linkgoron reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@nodejs-github-bot

nodejs-github-bot commented Jun 8, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

ShogunPanda
ShogunPanda approved these changes Jun 8, 2023
View reviewed changes
mcollina
mcollina approved these changes Jun 8, 2023
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@nodejs-github-bot

nodejs-github-bot commented Jun 8, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

lpinca
lpinca approved these changes Jun 8, 2023
View reviewed changes
Comment thread test/parallel/test-http-server-close-destroy-timeout.js
const { createServer } = require('http');
const { kConnectionsCheckingInterval } = require('_http_server');

const server = createServer(function(req, res) {});

@lpinca lpinca Jun 8, 2023

Copy link
Copy Markdown
Member

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.

Suggested change
const server = createServer(function(req, res) {});
const server = createServer();

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread test/parallel/test-https-server-close-destroy-timeout.js
cert: fixtures.readKey('agent1-cert.pem')
};

const server = createServer(options, function(req, res) {});

@lpinca lpinca Jun 8, 2023

Copy link
Copy Markdown
Member

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.

Suggested change
const server = createServer(options, function(req, res) {});
const server = createServer(options);

Sorry, something went wrong.

Uh oh!

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

All reactions
mcollina
mcollina approved these changes Jun 10, 2023
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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 awesome. I think I suffered from this bug as well.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ShogunPanda ShogunPanda added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 10, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 10, 2023
@nodejs-github-bot

nodejs-github-bot commented Jun 10, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@ShogunPanda ShogunPanda added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Jun 10, 2023
RafaelGSS pushed a commit that referenced this pull request Jul 3, 2023
@Linkgoron @RafaelGSS
https: fix connection checking interval not clearing on server close
40ae6eb
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: #48373
PR-URL: #48383
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Jul 3, 2023
v20.4.0 proposal #48643
Merged
@trevor-scheer trevor-scheer mentioned this pull request Jul 21, 2023
Test against Node 20, update tests for compatibility apollographql/apollo-server#7636
Merged
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@Linkgoron @Ceres6
https: fix connection checking interval not clearing on server close
8481c13
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: nodejs#48373
PR-URL: nodejs#48383
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@Linkgoron @Ceres6
https: fix connection checking interval not clearing on server close
8e59d48
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: nodejs#48373
PR-URL: nodejs#48383
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
ruyadorno pushed a commit that referenced this pull request Sep 7, 2023
@Linkgoron @ruyadorno
https: fix connection checking interval not clearing on server close
2fd05a0
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: #48373
PR-URL: #48383
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Sep 8, 2023
v18.18.0 proposal #49220
Merged
@ruyadorno

ruyadorno commented Sep 12, 2023

Copy link
Copy Markdown
Member

This PR broke citgm on v18.18.0-proposal. It's going to require manual backport and citgm validation before landing on v18.x-staging again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ruyadorno ruyadorno added the backport-requested-v18.x label Sep 12, 2023
@mcollina

mcollina commented Sep 12, 2023

Copy link
Copy Markdown
Member

How did it broke CITGM?

Linkgoron 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.

@ruyadorno ruyadorno mentioned this pull request Sep 12, 2023
http, https, http2: Server add Symbol.asyncDispose #48548
Closed
@ruyadorno

ruyadorno commented Sep 12, 2023

Copy link
Copy Markdown
Member

oh sorry I forgot to add some more details, it broke [email protected] on almost every platform (which might very much be of your interest @mcollina), here's a summary of the errors:

# Subtest: test/close-pipelining.test.js
     # Subtest: Should return 503 while closing - pipelining
         ok 1 - should be equivalent
         1..1
     ok 1 - Should return 503 while closing - pipelining # time=117.997ms
     
     # Subtest: Should not return 503 while closing - pipelining - return503OnClosing: false, skip Node >= v19.x
         not ok 1 - other side closed
           ---
           stack: |
             Socket.onSocketEnd (node_modules/undici/lib/client.js:1116:22)
           at:
             line: 1116
             column: 22
             file: node_modules/undici/lib/client.js
             function: Socket.onSocketEnd
           type: SocketError
           code: UND_ERR_SOCKET
           socket:
             localAddress: ::1
             localPort: 53232
             remoteAddress: null
             remotePort: null
             remoteFamily: null
             timeout: null
             bytesWritten: 195
             bytesRead: 376
           tapCaught: returnedPromiseRejection
           test: "Should not return 503 while closing - pipelining - return503OnClosing:
             false, skip Node >= v19.x"
           source: >2
           
               util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
             ---------------------^
           
             }
           ...
         
         1..1
         # failed 1 test
     not ok 2 - Should not return 503 while closing - pipelining - return503OnClosing: false, skip Node >= v19.x # time=61.927ms
     # Subtest: Current opened connection should continue to work after closing and return "connection: close" header - return503OnClosing: false, skip Node >= v19.x
         ok 1 - should not error
         ok 2 - should match pattern provided
         ok 3 - should match pattern provided
         not ok 4 - test unfinished
           ---
           stack: |
             Object.<anonymous> (test/close.test.js:207:1)
           test: 'Current opened connection should continue to work after closing and
             return "connection: close" header - return503OnClosing: false, skip Node >=
             v19.x'
           at:
             line: 207
             column: 1
             file: test/close.test.js
             function: Object.<anonymous>
           source: >
             const isV19plus = semver.gte(process.version, '19.0.0')
           
             test('Current opened connection should continue to work after closing and return "connection: close" header - return503OnClosing: false, skip Node >= v19.x', { skip: isV19plus }, t => {
           
             ^
               const fastify = Fastify({
                 return503OnClosing: false,
           ...
         
         1..4
         # failed 1 of 4 tests
     not ok 9 - Current opened connection should continue to work after closing and return "connection: close" header - return503OnClosing: false, skip Node >= v19.x # time=71.912ms

And here is the link to the full CITGM run: https://ci.nodejs.org/job/citgm-smoker/3229/

All reactions

Sorry, something went wrong.

Uh oh!

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

@ruyadorno

ruyadorno commented Sep 13, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

it looks like it also broke [email protected] on Linux. I'm recreating the proposal without this commit and running CITGM again, you can see the results here: https://ci.nodejs.org/job/citgm-smoker/3237/

btoueg and himself65 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

sparist pushed a commit to Distributive-Network/node that referenced this pull request Sep 13, 2023
@Linkgoron @sparist
https: fix connection checking interval not clearing on server close
4fd8cd6
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: nodejs#48373
PR-URL: nodejs#48383
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
This was referenced Oct 15, 2023
HTTP Server close is taking up to 5 seconds in node 18 #50188
Closed
fetch will always hang up about 4s nodejs/undici#2348
Closed
@H4ad H4ad mentioned this pull request Oct 16, 2023
[v18.x backport] https: fix connection checking interval not clearing on server close #50194
Closed
1 task
@targos targos added backported-to-v18.x and removed backport-requested-v18.x labels Nov 27, 2023
targos pushed a commit that referenced this pull request Nov 27, 2023
@Linkgoron @targos
https: fix connection checking interval not clearing on server close
2969722
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

Fixes: #48373
PR-URL: #48383
Backport-PR-URL: #50194
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@targos targos mentioned this pull request Nov 28, 2023
v18.19.0 release proposal #50953
Merged
@jsumners jsumners mentioned this pull request Dec 9, 2023
CI failure with v18.19.0 fastify/fastify#5198
Closed
@kumarrishav

kumarrishav commented Apr 2, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

why have we changed the behavior in minor release? i.e Note that this also adds a call to closeIdleConnections() to https.server.close .

Is there any way to keep old behavior on v18. I completely understand and agree with adding a new method to handle it but modifying the existing one i.e server.close, it broke our app/tests.

In an environment where we own client and server, we usually keep client timeout less than server keepalive timeout and let the client know by connection:close header to handle future request. Scenario: There could be multiple stack in different language talking to each other.

related to #52330

CC: @mcollina @ShogunPanda Thoughts

All reactions

Sorry, something went wrong.

Uh oh!

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

@Linkgoron

Linkgoron commented Apr 2, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

why have we changed the behavior in minor release? i.e Note that this also adds a call to closeIdleConnections() to https.server.close .

Is there any way to keep old behavior on v18. I completely understand and agree with adding a new method to handle it but modifying the existing one i.e server.close, it broke our app/tests.

In an environment where we own client and server, we usually keep client timeout less than server keepalive timeout and let the client know by connection:close header to handle future request. Scenario: There could be multiple stack in different language talking to each other.

related to #52330

CC: @mcollina @ShogunPanda Thoughts

This wasn't a semver-minor, it was a bug fix for a Node 19 change that was added here that missed that the added behavior to HTTP did not automatically apply to HTTPS, which was marked at the time as a semver-major.

If I'm understanding correctly, the backport to 18 has a mistake #50194, it shouldn't have added server.closeIdleConnections();. It should have only extracted the clear timeout to a "shared" method, without adding more functionality. Obviously it was not intentional (as indeed, the behavior change was originally marked as semver major). A PR would be welcome.

All reactions

Sorry, something went wrong.

Uh oh!

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

@kumarrishav kumarrishav mentioned this pull request Apr 2, 2024
[v18.x] http: remove closeIdleConnections function while calling server close #52334
Closed
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
https: fix connection checking interval not clearing on
332ad91
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

Fixes: nodejs/node#48373
PR-URL: nodejs/node#48383
Backport-PR-URL: nodejs/node#50194
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
https: fix connection checking interval not clearing on
f12e1c1
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

Fixes: nodejs/node#48373
PR-URL: nodejs/node#48383
Backport-PR-URL: nodejs/node#50194
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@michael42 michael42 mentioned this pull request Apr 26, 2024
http.server.close() closes idle connections since 18.19.0 #51677
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@ShogunPanda ShogunPanda ShogunPanda approved these changes
@lpinca lpinca lpinca approved these changes
@JungMinu JungMinu JungMinu approved these changes
@MoLow MoLow MoLow approved these changes
@marco-ippolito marco-ippolito marco-ippolito approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

commit-queue-squash PRs the Commit Queue should land as one squashed commit. http Issues and PRs related to the http subsystem. https Issues and PRs related to the https subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

https.Server does not call http.close

Uh oh!

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

12 participants

@Linkgoron @nodejs-github-bot @mscdex @ShogunPanda @ruyadorno @mcollina @kumarrishav @lpinca @JungMinu @MoLow @marco-ippolito @targos
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.