-
Type: Bug
-
Resolution: Done
-
Priority: 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.