fix(NODE-7859): reschedule RTT measurements after a failed ping - #5057
Draft
seanrmilligan wants to merge 1 commit into
Draft
seanrmilligan wants to merge 1 commit into
seanrmilligan wants to merge 1 commit into
Conversation
RTTPinger only armed its next timer on the success path, so the first interruption of the dedicated RTT connection stopped it permanently. Neither the connect() nor the command() rejection handler scheduled a retry, leaving latestRtt frozen at its last good value and feeding a stale RTT into server selection indefinitely. The SDAM spec's RttMonitor pseudocode places the heartbeatFrequencyMS wait outside the error handler, so a failed ping continues the loop. Extract scheduleNextMeasurement() and call it from both rejection handlers, guarded so a closed pinger does not re-arm. latestRtt is deliberately left untouched on failure: "If a hello or legacy hello call fails, the RTT is not updated", and the pseudocode's error branch explicitly does not reset the average. Reported in HELP-100351.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RTTPinger only sets the next timer on the success, so any interruption of the RTT connection stopped it permanently. Neither the connect() nor the command() rejection handler scheduled a retry, leaving latestRtt frozen at its last good value and feeding a stale RTT into server selection indefinitely.
The SDAM spec's RttMonitor pseudocode places the heartbeatFrequencyMS wait outside the error handler, so a failed ping continues the loop. Extract scheduleNextMeasurement() and call it from both rejection handlers, guarded so a closed pinger does not re-arm.
latestRtt is deliberately left untouched on failure: "If a hello or legacy hello call fails, the RTT is not updated", and the pseudocode's error branch explicitly does not reset the average.
Reported in HELP-100351.
Description
Summary of Changes
Notes for Reviewers
What is the motivation for this change?
For bug fixes
Current (incorrect) behavior:
Expected behavior:
How to reproduce:
Affected versions:
Release Highlight
Release notes highlight
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript