[CSHARP-1005] MongoServer.Create with ReplicaSetTagSet creates always a new Server Instance Created: 26/Jun/14  Updated: 02/Apr/15  Resolved: 26/Jun/14

Status: Closed
Project: C# Driver
Component/s: Connectivity
Affects Version/s: None
Fix Version/s: 1.9.2

Type: Bug Priority: Major - P3
Reporter: Alice Mauschberger Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive TagSets_Example.zip    

 Description   

Hi,

multiple instances of the same MongoClientSettings with ReplicaSetTagSets specified, leads to the following exception:
"MongoServer.Create has already created 100 servers which is the maximum number of servers allowed."

MongoDB.Driver.ReplicaSetTagSet.GetHashCode() calculates different Hashes for the same Tags.

Example Project attached.
thx



 Comments   
Comment by Githook User [ 26/Jun/14 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-1005: Fix ReadPreference to provide correct GetHashCode() values.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/b45945ed82066e61b49582704e10ad0530625243

Comment by Githook User [ 26/Jun/14 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-1005: Fix ReadPreference to provide correct GetHashCode() values.
Branch: v1.x
https://github.com/mongodb/mongo-csharp-driver/commit/a42ede2f8bb99afaae0a65b14f951d92ce0df0bc

Comment by Craig Wilson [ 26/Jun/14 ]

Thanks Alice. We'll look into this immediately.

Comment by Alice Mauschberger [ 26/Jun/14 ]

It seems that MongoDB.Driver.ReadPreference.GetHashCode() -> _tagSets.GetHashCode() is the entry point for this problem. MongoDB.Driver.ReplicaSetTagSet.GetHashCode() is never called in this scenario.

Generated at Wed Feb 07 21:38:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.