Skip to content

fix(NODE-7859): reschedule RTT measurements after a failed ping - #5057

Draft
seanrmilligan wants to merge 1 commit into
mongodb:mainfrom
seanrmilligan:sean.milligan/NODE-7859
Draft

seanrmilligan wants to merge 1 commit into
mongodb:mainfrom
seanrmilligan:sean.milligan/NODE-7859

Conversation

@seanrmilligan

Copy link
Copy Markdown
Contributor

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

  • Lint is passing (npm run check:lint)
  • 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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant