Skip to content

Commit 48bdbfd

Browse files
authored
PYTHON-4347 Ensure client can be opened after fork() (mongodb#1681)
1 parent 6f8a22d commit 48bdbfd

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

pymongo/asynchronous/mongo_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ async def target() -> bool:
896896
# this closure. When the client is freed, stop the executor soon.
897897
self_ref: Any = weakref.ref(self, executor.close)
898898
self._kill_cursors_executor = executor
899+
self._opened = False
899900

900901
def _should_pin_cursor(self, session: Optional[ClientSession]) -> Optional[bool]:
901902
return self._options.load_balanced and not (session and session.in_transaction)

pymongo/synchronous/mongo_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ def target() -> bool:
895895
# this closure. When the client is freed, stop the executor soon.
896896
self_ref: Any = weakref.ref(self, executor.close)
897897
self._kill_cursors_executor = executor
898+
self._opened = False
898899

899900
def _should_pin_cursor(self, session: Optional[ClientSession]) -> Optional[bool]:
900901
return self._options.load_balanced and not (session and session.in_transaction)

0 commit comments

Comments
 (0)