cursor timeout vs mongo connecttimeout

376 views
Skip to first unread message

Need Help

unread,
Oct 15, 2014, 3:00:55 PM10/15/14
to mongod...@googlegroups.com
We have set cursor to no time out, and mongooptions to 20 s.  Is there any conflict between cursor timeout and mongo connecttimeout?  In otherwise, can mongo return if it takes longer than 20 s to connect, but cursor stays open indefinitely?  Thanks!

Will Berkeley

unread,
Oct 15, 2014, 3:29:39 PM10/15/14
to mongod...@googlegroups.com
The two timeouts are for very different things. The cursor timeout refers to the amount of time the server will keep the cursor alive and able to return more results. The connection timeout is the time that the client will spend trying to connect to the server before giving up. The connection timeout just has to do with establishing the connection; you might be interested in the socket timeout, which is a timeout for how long the client will wait for a response from the server. It is possible for a client to fail an operation because of socket timeout and have the cursor still be open on the server because the cursor timeout hasn't been reached. The client can then retry the operation and keep getting more results from the cursor.

Be careful setting no timeout on cursors - you need to be sure to exhaust them or close them manually or they will pile up on the server. You can check how many cursors are lying about using db.serverStatus().

-Will
Reply all
Reply to author
Forward
0 new messages