Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-100

Spurious connection timeouts when competing for getaddrinfo lock

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.5
    • Component/s: asyncio
    • None

      From:

      https://groups.google.com/d/topic/mongodb-user/2oK6C3BrVKI/discussion

      On Mac and Windows, the Python interpreter locks around calls to getaddrinfo. A comment explains these are "systems on which getaddrinfo() is believed to not be thread-safe."

      When Motor opens a new connection to MongoDB it starts a timer, then calls getaddrinfo on the server address. If many other getaddrinfo calls are already enqueued (for example, if a web crawler is running in the same process), then Motor's call can spend more than connectTimeoutMS waiting in the queue for the getaddrinfo lock. The timer expires and raises AutoReconnect.

      It appears as if Motor can't connect to MongoDB, when in fact it simply couldn't acquire the getaddrinfo lock in time.

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

              Created:
              Updated:
              Resolved: