[SERVER-48151] fix RSM erase in SingleServerIsMasterMonitor and ServerPingMonitor onTopologyChanged method Created: 12/May/20  Updated: 29/Oct/23  Resolved: 18/May/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.4.0-rc5
Fix Version/s: 4.4.0-rc7, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Lamont Nelson Assignee: Lamont Nelson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Participants:

 Description   

non-deterministic parameter evaluation causes the erased range to be empty. use std::next for the end of the range.



 Comments   
Comment by Githook User [ 14/May/20 ]

Author:

{'name': 'Lamont Nelson', 'email': 'lamont.nelson@mongodb.com', 'username': 'lamontnelson'}

Message: SERVER-48151: fix unordered_map::erase bug; remove duplicates in rs connection string.

(cherry picked from commit 32ea52bbf377db1bf822276a80cd35af05289239)
Branch: v4.4
https://github.com/mongodb/mongo/commit/af0b2b1ceaa2e1e291e9ae7d9005892722846bd2

Comment by Githook User [ 13/May/20 ]

Author:

{'name': 'Lamont Nelson', 'email': 'lamont.nelson@mongodb.com', 'username': 'lamontnelson'}

Message: SERVER-48151: fix unordered_map::erase bug; remove duplicates in rs connection string.
Branch: master
https://github.com/mongodb/mongo/commit/32ea52bbf377db1bf822276a80cd35af05289239

Comment by Lamont Nelson [ 12/May/20 ]

For future reference, when a server is removed from being monitored the monitor instance for the server is shutdown via a call here, which puts it into a state where no more events will be generated. Since the erase was sometimes wrong due to non-deterministic parameter evaluation order, when the RSM tries to add that server again it sees that there was already an instance there and omits creating a new one. This causes the server never to be re-added to the topology since there are no ismaster replies to process.

The fix is simple, but since the bug was easy to overlook I kept the invariant checking the removal.

Comment by Lamont Nelson [ 12/May/20 ]

https://mongodbcr.appspot.com/587210005/

Generated at Thu Feb 08 05:16:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.