Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-221

client driver loses synchronization with comunication stream due to exceptions at certain points

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 12_01_17
    • Affects Version/s: 1.1.4, 1.1.5
    • Component/s: None
    • Labels:
      None
    • Environment:
      mongo server 1.6.5
    • Fully Compatible

      The ruby client driver loses track of its position in the stream of responses from the server if an exception occurs while Connection#send_with_safe_check or Connection#receive_message are running. This commonly occurs when the client application uses a Timeout; a Timeout::Error exception may be raised while Connection#receive is blocked. Other exceptions are possible here (due to other asynchronous signals or perhaps due to unexpected IO conditions). When an exception occurs at this point, the server will eventually send a response, but the client driver is no longer waiting for it. The response is typically consumed by the subsequent mongo operations; all following request appear to get the response from the preceding request.

      (Unless there is a sequence number in the mongo protocol that is being ignored by the client driver...) I'd advise adding an exception handler to the critical section of Connection#receive_message and Connection#send_with_safe_check that closes the socket when any exception occurs. (See attached patch)

            Assignee:
            kbanker Kyle Banker
            Reporter:
            joshuanapoli Joshua Napoli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: