PYTHON-5642 - getMore operations should do server selection if the server is unknown#2621
Merged
NoahStapp merged 4 commits intomongodb:masterfrom Nov 24, 2025
Merged
PYTHON-5642 - getMore operations should do server selection if the server is unknown#2621NoahStapp merged 4 commits intomongodb:masterfrom
NoahStapp merged 4 commits intomongodb:masterfrom
Conversation
Member
|
Typing error: Found 2 errors in 1 file (checked 148 source files)
"ServerDescription | None"; expected "ServerDescription" [list-item]
return [description] if description.is_server_type_known e...
^~~~~~~~~~~
pymongo/topology_description.py:325: error: Item "None" of
"ServerDescription | None" has no attribute "is_server_type_known" [union-attr]
return [description] if description.is_server_type_known e...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: Recipe `typing-mypy` failed on line 41 with exit code 1
error: Recipe `typing` failed on line 36 with exit code 1 |
blink1073
reviewed
Nov 24, 2025
pymongo/topology_description.py
Outdated
| # Ignore selectors when explicit address is requested. | ||
| description = self.server_descriptions().get(address) | ||
| return [description] if description else [] | ||
| return [description] if description.is_server_type_known else [] |
Contributor
Author
There was a problem hiding this comment.
Good catch, in theory yes.
blink1073
reviewed
Nov 24, 2025
| - Removed support for Eventlet. | ||
| Eventlet is actively being sunset by its maintainers and has compatibility issues with PyMongo's dnspython dependency. | ||
| - Use Zstandard support from the standard library for Python 3.14+, and use ``backports.zstd`` for older versions. | ||
| - Fixed a bug that could cause ``AutoReconnect("connection pool paused")`` errors when cursors fetched more documents from the database after SDAM heartbeat failures. |
Member
There was a problem hiding this comment.
I think this should be a 4.15.5 release
Member
|
drivers-pr-bot please backport to v4.15 |
Contributor
|
Sorry, unable to cherry-pick to v4.15, please backport manually. Here are approximate instructions:
|
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.
PYTHON-5642
Summary
Currently, cursor getMores against non-standalone, non-loadbalanced servers do not block for server selection, even if the pinned server for the operation is in an unknown state. This can cause the getMore to fail with a
Connection pool pausederror.Changes in this PR
getMore operations now wait for server selection if their pinned server is in an unknown state.
Testing Plan
Added a new test
test_server_selection_getMore_blocks.Screenshots (optional)
Checklist
Checklist for Author
Checklist for Reviewer {@primary_reviewer}