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

MasterSlaveConnection is missing disconnect() method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      pymongo 1.9, python 2.6.2, mongod 1.6.3

      Description

      I'm working on a rebalancing-after-failover feature for our application, and so I'm restarting hosts in our 3-host replica set frequently and observing the pymongo failover and our custom code which is reconnecting the slaves as needed. It is possible that I need to handle an edge case in my code to ensure that I don't swap out slave instances in the middle of a transaction, but the bug described here needs to be fixed regardless.

      Here's the part of the stack trace in question:

        File "<path>/lib/python2.6/site-packages/pymongo/cursor.py", line 564, in _refresh
          self.__query_spec(), self.__fields))
        File "<path>/lib/python2.6/site-packages/pymongo/cursor.py", line 535, in __send_message
          db.connection.disconnect()
        File "<path>/lib/python2.6/site-packages/pymongo/database.py", line 578, in __call__
          "failing because no such method exists." % self.__name)
      TypeError: 'Database' object is not callable. If you meant to call the 'disconnect' method on a 'Connection' object it is failing because no such method exists.

      The problem here is that MasterSlaveConnection does not have a disconnect method, so its _getattr_ method is used, which returns a Database instance.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: