[CDRIVER-830] Exhaust cursors must destroy the stream if it hasn't finished Created: 04/Sep/15  Updated: 19/Oct/16  Resolved: 30/Sep/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.2-beta1
Fix Version/s: 1.2-rc0

Type: Bug Priority: Major - P3
Reporter: Hannes Magnusson Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-683 Temporary write failure does not disc... Closed
is related to CDRIVER-810 mongoc_cluster_disconnect_node() does... Closed
is related to CDRIVER-894 test_exhaust_cursor fails on new reco... Closed
is related to CDRIVER-890 mongoc_cluster_node_reconnect must al... Closed

 Description   

I haven't looked at how this works in 1.1, but in 1.2 when destroying an exhaust cursor code kicks in:

 334 void                                                                                 
 335 _mongoc_cursor_destroy (mongoc_cursor_t *cursor)                                     
 336 {                                                                                    
 337    ENTRY;                                                                            
 338                                                                                      
 339    bson_return_if_fail(cursor);                                                      
 340                                                                                      
 341    if (cursor->in_exhaust) {                                                         
 342       cursor->client->in_exhaust = false;                                            
 343       if (!cursor->done) {                                                           
 344          mongoc_cluster_disconnect_node (                                            
 345             &cursor->client->cluster,                                                
 346             cursor->hint);                                                           
 347       }
348    } else if (cursor->rpc.reply.cursor_id) {                                         
       
....

The only problem is mongoc_cluster_disconnect_node() doesn't disconnect the node in single threaded mode.

The test that is supposed to confirm this behavior (test_exhaust_cursor) also seems to enforce that we don't disconnect the node as it starts failing when the node is actually disconnected.



 Comments   
Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-830: Properly close a node in exhaust and re-add it to the scanner
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/ac1449d5db0b8fe59e7312081ef1ac3237e5ad3e

Comment by Githook User [ 26/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-830: Properly close a node in exhaust and re-add it to the scanner
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/ac1449d5db0b8fe59e7312081ef1ac3237e5ad3e

Comment by Githook User [ 30/Sep/15 ]

Author:

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

Message: CDRIVER-830 Much simpler reconnects.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/73f04b86dc61afcf8f922c9e46bddeec621f23f4

Comment by Githook User [ 24/Sep/15 ]

Author:

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

Message: CDRIVER-830 do blocking reconnect if single-threaded

The new mongoc_cluster_node_reconnect initiates a non-blocking reconnect
but doesn't wait for connection to complete. If the driver is in single-
threaded mode (so the scanner and the application share a connection)
and immediately uses that server, connection hasn't completed:

cursor error: Failure during socket delivery: Socket not connected (57)

With this change, apply connectTimeoutMS to the reconnection in single-
threaded mode.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/df781c01b5512a3e598b873967619a9eba7e0871

Comment by A. Jesse Jiryu Davis [ 22/Sep/15 ]

Bug in the new mongoc_cluster_node_reconnect, it initiates a non-blocking reconnect but doesn't wait for connection to complete. If the driver is in single-threaded mode (so the scanner and the application share a connection) and immediately sends a message to that server, connection hasn't completed:

cursor error: Failure during socket delivery: Socket is not connected (57)

Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-830: Properly close a node in exhaust and re-add it to the scanner
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/ac1449d5db0b8fe59e7312081ef1ac3237e5ad3e

Comment by Hannes Magnusson [ 11/Sep/15 ]

Appears we already forbid exhaust on mongos, and you cannot set a limit and specify exhaust.

Comment by Bernie Hackett [ 04/Sep/15 ]

Also need to forbid the use of exhaust with mongos.

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