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

feat(NODE-5189): deprecate tcp keepalive options #3621

Merged
merged 4 commits into from Apr 13, 2023
Merged

feat(NODE-5189): deprecate tcp keepalive options #3621

merged 4 commits into from Apr 13, 2023

Conversation

durran
Copy link
Member

@durran durran commented Apr 4, 2023

Description

Updates TCP keepalive options to the spec where appropriate.

What is changing?

  • Deprecates the keepAlive and keepAliveInitialDelay options.
  • Defaults keepAliveInitialDelay to 300 seconds.

Node does not allow fine tuning of the keepalive options as per the spec, so we set the initial delay and then accept the other settings that Node sets internally. This results in:

  • SO_KEEPALIVE=1
  • TCP_KEEPIDLE=300000
  • TCP_KEEPCNT=10
  • TCP_KEEPINTVL=1
Is there new documentation needed for these changes?

mongodb/docs-node#639

What is the motivation for this change?

NODE-3607

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@durran durran marked this pull request as ready for review April 4, 2023 10:44
@nbbeeken nbbeeken self-requested a review April 4, 2023 21:45
@nbbeeken nbbeeken self-assigned this Apr 4, 2023
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Apr 4, 2023
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

@durran No concerns with the deprecations (as long as there is also a clear ticket to remove the options), but changing the defaults is arguably breaking and I think that's why we framed NODE-3607 as a spike; can we take this back and discuss it as a team? I didn't see a kickoff comment or a link to an external doc summarizing the results of the investigation, but some notes addressing the 6 spec callouts point by point would help figure out what changes can happen now and which ones need a follow up ticket.

@@ -864,12 +864,14 @@ export const OPTIONS = {
return wc;
}
},
/** @deprecated - Will not be able to turn off in the future. */
Copy link
Contributor

Choose a reason for hiding this comment

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

We have the deprecated: true property that we can add to the option description objects here to get warnings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added option with message.

// Default to delay to 300 seconds. Node automatically then sets TCP_KEEPINTVL to 1 second
// which is acceptable to the recommendation of 10 seconds and also cannot be configured.
// TCP_KEEPCNT is also set to 10 in Node and cannot be configured. (Recommendation is 9)
const keepAliveInitialDelay = options.keepAliveInitialDelay || 300000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const keepAliveInitialDelay = options.keepAliveInitialDelay || 300000;
const keepAliveInitialDelay = options.keepAliveInitialDelay;

Because of the defaulting, we should always have a defined number here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@durran
Copy link
Member Author

durran commented Apr 5, 2023

@durran No concerns with the deprecations (as long as there is also a clear ticket to remove the options), but changing the defaults is arguably breaking and I think that's why we framed NODE-3607 as a spike; can we take this back and discuss it as a team? I didn't see a kickoff comment or a link to an external doc summarizing the results of the investigation, but some notes addressing the 6 spec callouts point by point would help figure out what changes can happen now and which ones need a follow up ticket.

I've update the NODE-3607 JIRA ticket in the comments with notes for each point in the spec.

@durran durran closed this Apr 5, 2023
@durran durran reopened this Apr 11, 2023
@dariakp dariakp changed the title feat(NODE-3607): update tcp keepalive options feat: deprecate tcp keepalive options Apr 11, 2023
@durran durran changed the title feat: deprecate tcp keepalive options feat(NODE-5189): deprecate tcp keepalive options Apr 12, 2023
// Default to delay to 300 seconds. Node automatically then sets TCP_KEEPINTVL to 1 second
// which is acceptable to the recommendation of 10 seconds and also cannot be configured.
// TCP_KEEPCNT is also set to 10 in Node and cannot be configured. (Recommendation is 9)
const keepAliveInitialDelay = options.keepAliveInitialDelay;
Copy link
Contributor

Choose a reason for hiding this comment

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

We only want to do the deprecations; changing the defaults would be a potentially breaking change (at any rate it would change behavior), so we can do that in NODE-5190.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the changes, only deprecations now.

@nbbeeken nbbeeken added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Apr 13, 2023
@nbbeeken nbbeeken merged commit cc7c75a into main Apr 13, 2023
8 of 21 checks passed
@nbbeeken nbbeeken deleted the NODE-3607 branch April 13, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
4 participants