Skip to content

Conversation

patrickfreed
Copy link
Contributor

RUST-856

This PR fixes a race between server selection requesting an update to the topology and a monitor subscribing to those requests, which occasionally would result in the min_heartbeat_frequency test failing.

topology.notify_topology_changed();
}

let mut topology_check_requests_subscriber =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My theory is that the following sequence happens:

  • check completes
  • monitor notifies that topology changed
  • operation sleeping in server selection gets notification and quickly fails server selection, requesting another check
  • monitor starts subscribing to request checks, missing the previous one
  • monitor sleeps until heartbeatFrequencyMS is hit

This fixes that by ensuring any requests that come in after the check will be recorded too, hopefully fixing this case.

@patrickfreed patrickfreed marked this pull request as ready for review September 10, 2021 22:31
@patrickfreed patrickfreed merged commit 81f1602 into mongodb:master Sep 13, 2021
awitten1 pushed a commit to awitten1/mongo-rust-driver that referenced this pull request Sep 21, 2021
patrickfreed added a commit to patrickfreed/mongo-rust-driver that referenced this pull request Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants