[CDRIVER-112] No socket time out Created: 03/Feb/12  Updated: 03/May/17  Resolved: 23/Mar/12

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

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

windows 7 and 64 bit debian



 Description   

We are using Mongo 'C' driver to insert objects in mongodb. Our problem is, the driver gets stucked indefinitely (saw for 30 mins) at recv and send socket calls. This happens when we turn off server running mongodb abruptly.
As we analyzed problem deeper, we observed that "Mongo 'C' driver does not have socket timeout".
Will it make client hang always, when server abruptly terminates socket connection?



 Comments   
Comment by Kyle Banker [ 10/Feb/12 ]

I don't see any problem with setting the socket op timeout.

Comment by jitendra [ 08/Feb/12 ]

What is a good practice to follow in this case?
Whether to use socket timeout in application so that atleast socket calls would return.
or not to use socket timeout?

Comment by Kyle Banker [ 05/Feb/12 ]

Are you running on Linux? If you compile like so:

scons --use-platform=LINUX

You'll then have socket timeout support using the following function:

int mongo_set_op_timeout( mongo *conn, int millis );

See here:
http://api.mongodb.org/c/current/api/mongo_8h_source.html

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