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

PyMongo does not publish Server or Topology change events for "Network error when reading or writing" or "not master" and "node is recovering"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.11
    • Monitoring
    • None

    Description

      When application operations fail with network errors or not master errors, we reset the server to Unknown according to the rules in SDAM Error Handling section. However pymongo does not publish any ServerDescriptionChangedEvent or TopologyDescriptionChangedEvent:
      https://github.com/mongodb/mongo-python-driver/blob/3.10.1/pymongo/topology.py#L552-L554

          def _reset_server(self, address, reset_pool):
      ...
                  # Mark this server Unknown.
                  self._description = self._description.reset_server(address)
                  self._update_servers()
      

      We should mark the server unknown like this:

          def _reset_server(self, address, reset_pool):
      ...
                  # Mark this server Unknown.
                  unknown_sd = ServerDescription(address)
                  self._process_change(unknown_sd)
      

      _process_change automatically handles the event publishing.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: