PYTHON-5821 - Fix ordering issue between event publish and logging fo…#2867
Open
NoahStapp wants to merge 1 commit into
Open
PYTHON-5821 - Fix ordering issue between event publish and logging fo…#2867NoahStapp wants to merge 1 commit into
NoahStapp wants to merge 1 commit into
Conversation
…r connection creation and ready
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a race/ordering issue between CMAP event publication and connection-related debug logging by ensuring the debug log is emitted before publishing the corresponding CMAP events for connection creation and connection ready. This is a follow-up to #2796, extending the same ordering guarantee to additional connection lifecycle points.
Changes:
- Reordered
connection_createdemission to occur after the correspondingCONN_CREATEDdebug log. - Reordered
connection_readyemission to occur after the correspondingCONN_READYdebug log.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pymongo/synchronous/pool.py | Reorders connection created/ready CMAP event publication to occur after debug logging. |
| pymongo/asynchronous/pool.py | Reorders connection created/ready CMAP event publication to occur after debug logging (async pool). |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
sleepyStick
approved these changes
Jun 11, 2026
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.
…r connection creation and ready
PYTHON-5821
Changes in this PR
Follow-up to #2796 that fixes the same issue for connection creation and ready events/logs.
Test Plan
Existing tests.
Checklist
Checklist for Author
[ ] Did you update the changelog (if necessary)?[ ] Is any followup work tracked in a JIRA ticket? If so, add link(s).Checklist for Reviewer