[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:
Depends
is depended on by PHPC-1012 Upgrade libbson and libmongoc to 1.8.1 Closed
Related
is related to CDRIVER-2286 /Cursor/hint/no_warmup/pooled intermi... Closed

 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: CDRIVER-2272 avoid err in BSON_STATIC_ASSERT
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/dddc3fe4cca44f162a66670d522068bbb436b006

Comment by Githook User [ 12/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2272 properly reinit server description
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/14b679ca11083152360aae48cfb9cff801e706d2

Comment by Githook User [ 18/Sep/17 ]

Author:

{'username': 'ajdavis', 'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2272 properly reinit server description
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/a09540c704f74bf99481854b0d809a6880cd21a9

Comment by Githook User [ 15/Sep/17 ]

Author:

{'username': 'ajdavis', 'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2272 properly reinit server description
Branch: r1.8
https://github.com/mongodb/mongo-c-driver/commit/14b679ca11083152360aae48cfb9cff801e706d2

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:CDRIVER-2272 skip cursor test for now
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/f1ea83b3d48f3691e7fa042bfec703762df79937

Comment by A. Jesse Jiryu Davis [ 13/Sep/17 ]

Another example:

https://evergreen.mongodb.com/task_log_raw/mongo_c_driver_power8_ubuntu1604_test_latest_replica_set_noauth_sasl_nossl_154c7202d256ab3c6fff22becf1481c53a137cc1_17_09_13_16_44_57/0?type=T

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