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

ServerSelectionTimeoutError ai_socktype not supported with PyPy and gevent

      Hello - I'm not exactly sure where this issue originates, but thought I'd report it here first in case others happen to encounter it as well.

      After running the snippet below and then attempting to use the client, a ServerSelectionTimeoutError occurs when running under PyPy with gevent. This error doesn't happen when running with pymongo 3.3 or 3.2 (with the other components remaining the same)

      Things also work fine with pymongo 3.4.0 under PyPy when gevent monkey patching is not applied. Code also works as expected under CPython with gevent monkey patching applied
      (tested CPython 3.5+)

      from gevent import monkey
      monkey.patch_all()
      
      import pymongo
      client = pymongo.MongoClient('localhost', 27017)
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/tmp/mongotest-pypy/site-packages/pymongo/collection.py", line 1102, in find_one
          for result in cursor.limit(-1):
        File "/tmp/mongotest-pypy/site-packages/pymongo/cursor.py", line 1114, in next
          if len(self.__data) or self._refresh():
        File "/tmp/mongotest-pypy/site-packages/pymongo/cursor.py", line 1036, in _refresh
          self.__collation))
        File "/tmp/mongotest-pypy/site-packages/pymongo/cursor.py", line 873, in __send_message
          **kwargs)
        File "/tmp/mongotest-pypy/site-packages/pymongo/mongo_client.py", line 888, in _send_message_with_response
          server = topology.select_server(selector)
        File "/tmp/mongotest-pypy/site-packages/pymongo/topology.py", line 214, in select_server
          address))
        File "/tmp/mongotest-pypy/site-packages/pymongo/topology.py", line 189, in select_servers
          self._error_message(selector))
      ServerSelectionTimeoutError: mongodb:27017: [Errno -7] ai_socktype not supported
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            corbinbs Brian Corbin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: