Skip to content

Conversation

@blink1073
Copy link
Member

@blink1073 blink1073 commented Oct 22, 2025

PYTHON-5517

Summary

Update the behavior of connection pool backoff to match the technical design doc and add/update tests.

Changes in this PR

Behavior Changes

  • Network timeouts should also induce backoff state.
  • An operation that is blocked waiting for backoff in the connection checkout process SHOULD be unblocked when an in-use connection is returned to the pool. This avoids forcing one operation to pay the latency cost of waiting for backoff when other connections become available.
  • Backoff messages should include the attempt number
  • After backoff, the pool should return to ready state
  • Successful heartbeat should not mark the pool as ready when in backoff mode

Test Changes

  • Update the tests that used a network timeout with a hello - return another error type and don't block or close the connection.
  • Verify that a connection close on a hello does not clear the pool
  • Verify that a connection timeout on a hello does not clear the pool
  • Verify that the pool returns to ready state after backoff
  • Verify the pool backoff monitor events content
  • Verify the pool backoff log message content
  • Verify that we can transition from backoff to error state
  • Verify that a failed heartbeat clears the pool if in backoff state
  • Verify that a successful heartbeat does not change the pool to ready if in backoff

Testing Plan

  • Run the connection_logging, connection_monitoring, load_balancing, and SDAM tests locally
  • Tests are run in Evergreen automatically in PRs

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is the intention of the code captured in relevant tests?
  • If there are new TODOs, has a related JIRA ticket been created?

Checklist for Reviewer {@primary_reviewer}

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Have you checked for spelling & grammar errors?
  • Is all relevant documentation (README or docstring) updated?

@blink1073 blink1073 changed the title PYTHON-5517 Updates to connection pool backoff PYTHON-5517 Updates to connection pool backoff behavior and tests Oct 22, 2025
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.

2 participants