-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5492 Fix handling of MaxTimeMSExpired responses #2477
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
Merged
+12
−2
Conversation
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
drivers-pr-bot please backport to v4.14 |
Putting back into draft. Even with the flaky, the tests are still failing. We might need to skip and file a SERVER ticket. |
sleepyStick
approved these changes
Aug 16, 2025
mongodb-dbx-release-bot bot
pushed a commit
that referenced
this pull request
Aug 16, 2025
(cherry picked from commit 9dbccbe)
blink1073
added a commit
that referenced
this pull request
Aug 18, 2025
#2479) Co-authored-by: Steven Silvester <[email protected]>
ShaneHarvey
reviewed
Aug 18, 2025
# Append timeout details to MaxTimeMSExpired responses. | ||
if first.get("code") == 50: | ||
timeout_details = _get_timeout_details(conn.opts) # type:ignore[has-type] | ||
first["errmsg"] += format_timeout_details(timeout_details) # type:ignore[index] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail if the document_class is RawBSONDocument:
>>> from bson.raw_bson import *
>>> c = MongoClient(document_class=RawBSONDocument)
>>> _ = c.t.t.insert_many([{'x':i} for i in range(1000000)])
>>> c.t.t.find_one({'x': -1}, maxTimeMS=1)
...
File "/Users/shane/git/mongo-python-driver/pymongo/synchronous/server.py", line 231, in run_operation
first["errmsg"] += format_timeout_details(timeout_details) # type:ignore[index]
~~~~~^^^^^^^^^^
TypeError: 'RawBSONDocument' object does not support item assignment
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.
It turns out we did have a race condition as to whether we'd get a client side or server side timeout. This ensures we get the same information either way.
Also fixes a sporadic bug when installing
just
by ensuring that the bin dir exists before attempting to install into it.