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"

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

      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.

            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: