[CDRIVER-2272] mongoc_server_description_t tags and compressors improperly reinitialized Created: 10/Sep/17 Updated: 28/Oct/23 Resolved: 15/Sep/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.8.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Whenever a mongoc_server_description_t struct is reset, it zeroes all fields that are declared after "set_name". This makes "tags" and "compressors" invalid. If the server reports any tags or compressors in its ismaster reply then these fields are set correctly, otherwise they remain invalid. The solution is to avoid the hack of zeroing all fields declared after set_name. Factor out a function that explicitly resets each field, and call that function from mongoc_server_description_init and mongoc_server_description_reset. |
| Comments |
| Comment by Githook User [ 14/Oct/17 ] |
|
Author: {'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}Message: |
| Comment by Githook User [ 12/Oct/17 ] |
|
Author: {'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}Message: |
| Comment by Githook User [ 18/Sep/17 ] |
|
Author: {'username': 'ajdavis', 'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com'}Message: |
| Comment by Githook User [ 15/Sep/17 ] |
|
Author: {'username': 'ajdavis', 'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com'}Message: |
| Comment by A. Jesse Jiryu Davis [ 14/Sep/17 ] |
|
If you used a read pref with tags and disconnected and reconnected, it's possible the driver could crash. The addition of "compressors" to the end of the mongoc_server_description_t in 1.8.0 adds more risk. |
| Comment by Ramon Fernandez Marina [ 14/Sep/17 ] |
|
Author: {'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}Message: |
| Comment by A. Jesse Jiryu Davis [ 13/Sep/17 ] |
|
Another example: |