-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.2.1, 2.3
-
Component/s: None
-
None
If a safe insert, update, or remove receives an error message from the server via getLastError then it raises an OperationFailure. For example, it raises a DuplicateKeyError if violating a unique index. In this case the socket used for the operation should not be closed, but it is, if auto_start_request=False. This bug is present in both Connection and ReplicaSetConnection.
This causes unnecessary connection churn for applications that turn off auto_start_request, and which cause frequent OperationFailures in the course of ordinary operation. For example, an application might ensure a record is present in a collection exactly once by attempting to insert it on every request, expecting to receive a DuplicateKeyError on every attempt after the first.