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

Pool leaves socket open when authentication fails

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.11
    • Affects Version/s: 3.11
    • Component/s: None
    • None

      Pool leaves socket open when authentication fails:

      test_client_handshake_saslSupportedMechs (tests.test_handshake.TestHandshake) ... /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/traceback.py:220: ResourceWarning: unclosed <socket.socket fd=8, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 56287), raddr=('127.0.0.1', 56285)>
        tb.tb_frame.clear()
      Object allocated at (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", lineno 890
          self._bootstrap_inner()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", lineno 932
          self.run()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", lineno 870
          self._target(*self._args, **self._kwargs)
        File "/Users/shane/git/pymongo-mockup-tests/venv/python3.8/lib/python3.8/site-packages/mockupdb/__init__.py", lineno 135
          result[0] = fn(*args, **kwargs)
        File "/Users/shane/git/mongo-python-driver/pymongo/database.py", lineno 736
          with self.__client._socket_for_reads(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", lineno 113
          return next(self.gen)
        File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", lineno 1319
          with self._get_socket(server, session) as sock_info:
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", lineno 113
          return next(self.gen)
        File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", lineno 1238
          with server.get_socket(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", lineno 113
          return next(self.gen)
        File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", lineno 1164
          sock_info = self._get_socket(all_credentials)
        File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", lineno 1211
          sock_info = self.connect(all_credentials)
        File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", lineno 1122
          sock = _configured_socket(self.address, self.opts)
        File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", lineno 929
          sock = _create_connection(address, options)
        File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", lineno 891
          sock = socket.socket(
      ok
      

      This was caused by PYTHON-2158.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: