Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-395

Sockets unnecessarily closed after operation failures

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.2.1, 2.3
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            jesse A. Jesse Jiryu Davis
            Reporter:
            jesse A. Jesse Jiryu Davis
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: