Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-830

Exhaust cursors must destroy the stream if it hasn't finished

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2-rc0
    • Affects Version/s: 1.2-beta1
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: