[CDRIVER-140] -1 is returned on successful mongo_connect Created: 19/May/12  Updated: 19/Oct/16  Resolved: 01/Jun/12

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.5.2
Fix Version/s: 0.6

Type: Bug Priority: Major - P3
Reporter: Pawel Assignee: Kyle Banker
Resolution: Done Votes: 0
Labels: connection
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Oracle Linux 6, 64bit, standard packages only



 Description   

I'm calling simple mongo_connect(), but I get MONGO_ERROR back, even if the connection succeeds.

(gdb) next
904 if (replica_set)

{ (gdb) 920 mongo_servers->host, mongo_servers->port); (gdb) list 915 result = mongo_replset_connect(&wi->connection); 916 917 }

else {
918
919 result = mongo_connect(&wi->connection,
920 mongo_servers->host, mongo_servers->port);
(gdb) next
919 result = mongo_connect(&wi->connection,
(gdb) print result
$1 = 0x7fff
(gdb) print wi->connection.err
$2 = MONGO_CONN_SUCCESS

I have to check connection->err irrespective of the return code from mongo_connect()

The connection is, in fact, successful, I can send objects and everything.



 Comments   
Comment by Pawel [ 29/May/12 ]

Verified in 0.6

Comment by Kyle Banker [ 25/May/12 ]

Have not been able to reproduce this. Let us know if you can.

Comment by Pawel [ 21/May/12 ]

I only have one node - it's a development system.
I checked isMaster flag:
[vps@druid]~/soft/mongodb-linux-x86_64-2.0.5$ ./bin/mongo xl4
MongoDB shell version: 2.0.5
connecting to: xl4
> db.isMaster();

{ "ismaster" : true, "maxBsonObjectSize" : 16777216, "ok" : 1 }

>

I don't have a test program, and 0.6 (I assume you made your changes to master only), has incompatible changes on write/inserts (with these "concern" things). I'll try to switch soon, and let you know how it went.

Comment by Kyle Banker [ 21/May/12 ]

Can you update your checkout and try again? I just fixed a related bug that may be causing this.

Which version of MongoDB are you running? Are you connecting to a secondary or a primary? Can you connect to the shell and print the result of db.isMaster() here?

Thanks.

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