Skip to content

fix(memory): enforce closed state in MongoDBSession - #4176

Merged
seratch merged 1 commit into
mainfrom
fix/mongodb-session-closed-state
Aug 4, 2026
Merged

fix(memory): enforce closed state in MongoDBSession#4176
seratch merged 1 commit into
mainfrom
fix/mongodb-session-closed-state

Conversation

@seratch

@seratch seratch commented Aug 4, 2026

Copy link
Copy Markdown
Member

This pull request fixes MongoDBSession lifecycle handling for sessions created with from_uri(). Closing an owned client now makes the session terminal before releasing the client, so subsequent session operations and ping() fail fast with RuntimeError instead of continuing against a released client.

Sessions using an injected client preserve caller ownership: session.close() remains a no-op and the session stays usable. The change also documents this lifecycle contract and covers successful, repeated, failed, and cancelled cleanup paths.

Make owned MongoDB sessions terminal after close while preserving injected-client ownership and usability. Cover successful, failed, cancelled, and repeated cleanup paths and document the lifecycle contract.

Co-authored-by: Chinmay V <203952148+chinmayv095@users.noreply.github.com>
@seratch seratch added this to the 0.19.x milestone Aug 4, 2026
@seratch
seratch enabled auto-merge (squash) August 4, 2026 22:26
@seratch
seratch merged commit 046f82b into main Aug 4, 2026
9 checks passed
@seratch
seratch deleted the fix/mongodb-session-closed-state branch August 4, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant