[CSHARP-449] MongoServer.VerifyInstances modifies collection that is being iterated Created: 18/Apr/12 Updated: 02/Apr/15 Resolved: 20/Apr/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4.1 |
| Fix Version/s: | 1.4.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aristarkh Zagorodnikov | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
The MongoServer.VerifyInstances iterates over the _instances member. Unfortunately, it occasionally calls RemoveInstance (when list is updated). This leads to _instances list to be updated and iteration to fail. I think snapshotting a list of instances with ToArray() call would be enough. |
| Comments |
| Comment by Craig Wilson [ 19/Apr/12 ] | |||||||
|
Pull request submitted. | |||||||
| Comment by Aristarkh Zagorodnikov [ 19/Apr/12 ] | |||||||
|
Counting backwards is surely better than ToArray(). | |||||||
| Comment by Craig Wilson [ 19/Apr/12 ] | |||||||
|
How about counting backwards so we don't have to make a copy...
|