-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-4700 - Convert CSFLE tests to async #1907
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
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4158326
PYTHON-4700 - Convert CSFLE tests to async
NoahStapp acc8bdc
Add async TestSpecCreator
NoahStapp e6d4b11
Fix imports
NoahStapp d6a0429
Merge branch 'master' into PYTHON-4700
NoahStapp 1922702
Linting
NoahStapp 97f39dd
Predicate
NoahStapp 7a4df29
Add test duration
NoahStapp c589fca
Merge branch 'master' into PYTHON-4700
NoahStapp 689b0b8
Cleanup
NoahStapp 6feec44
WIP
NoahStapp 17388d1
Vastly improve performance
NoahStapp b472d3a
Async KMS
NoahStapp 3bdd381
Fix deadline
NoahStapp 8e6a30d
Fix async KMS
NoahStapp 8ca4b0e
Fix _require
NoahStapp a229746
Type error fixes
NoahStapp 88bf8d8
Merge branch 'master' into PYTHON-4700
NoahStapp 59a95cc
10x timeoutMS listCollection timeouts for socket consistency on Linux
NoahStapp b12abc5
Merge branch 'master' into PYTHON-4700
NoahStapp 72303d6
Cleanup
NoahStapp 2a77285
Typing fixes + comment
NoahStapp 24ba64a
Merge branch 'master' into PYTHON-4700
NoahStapp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Why only once?
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 is to support KMS requests, which require that the read returns the first batch immediately to accurately update the expected length.
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.
That doesn't sound right. If we know how much we need to read we should be looping until we read that amount.
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 loop inside
_async_kms_request
changeskms_context.bytes_needed
with eachrecv
andfeed
call. If we allowasync_receive_data_socket
to run until the initialkms_context.bytes_needed
number of bytes is read, it will result in an error.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 is the behavior I observed that led to this change:
kms_context.bytes_needed = N
async_receive_data_socket returns with X bytes read, X < N
kms_context.feed is called
kms_context.bytes_needed is now not N - X, but a different value
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.
Oh I see, looks like that's intentional behavior in libmongocrypt:
https://github.com/mongodb/libmongocrypt/blob/7aeaec4/src/mongocrypt-kms-ctx.c#L47-L51
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.
Yeah, it's a little odd but this approach allows us to reuse as much code as possible.
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.
Can you add Shane's note as a comment for future readers?