[CDRIVER-540] connectTimeoutMS (and probably others) option ignored unless in lower case Created: 24/Feb/15  Updated: 19/Oct/16  Resolved: 10/Mar/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.0.2
Fix Version/s: 1.1.2

Type: Bug Priority: Minor - P4
Reporter: Andrew Clayton Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 6.x / x86-64

glibc 2.12 / gcc 4.4.7



 Description   

When specifying the connectTimeoutMS option e.g

mongodb://localhost/test?connectTimeoutMS=100

This option is ignored and the default of 10000 is used.

This is due to this option being added internally under the name as specified (i.e mixed case) but when it is being checked for in mongoc-client.c::mongoc_client_connect_tcp() it is being searched for in lower case, i.e we have

94 if ((options = mongoc_uri_get_options (uri)) &&
95 bson_iter_init_find (&iter, options, "connecttimeoutms") &&

Above line is the problem.

96 BSON_ITER_HOLDS_INT32 (&iter)) {
97 if (!(connecttimeoutms = bson_iter_int32(&iter)))

{ 98 MONGOC_DEFAULT_CONNECTTIMEOUTMS); 99 connecttimeoutms = MONGOC_DEFAULT_CONNECTTIMEOUTMS; 100 }

101 }

Using ?connecttimeoutms=100 works as expected. This will maybe effect more things, I haven't really looked further.

I'm not sure what the intention is here. All the MongoDB documentation uses mixed case.

Cheers,
Andrew



 Comments   
Comment by Andrew Clayton [ 25/Feb/15 ]

Pull request here: https://github.com/mongodb/mongo-c-driver/pull/178

Comment by Andrew Clayton [ 25/Feb/15 ]

OK, I guess it should be using bson_iter_init_find_case()

I'll knock up a patch...

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