Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4892

Running server in auth mode fails to close cursors leading to cursor accumulation on the server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.1.1
    • Affects Version/s: 2.0.2, 2.0.3
    • Component/s: Querying, Security
    • Labels:
      None
    • Environment:
    • Fully Compatible
    • ALL

      Setup for reproducing the issue

      ---------------------------------------- app to use

      require 'sinatra'
      require 'mongo'
      require 'json'
      
      @@conn= Mongo::Connection.new('192.168.0.192', 27017);
      @@db1= @@conn.db('tweet')
      @@db1.authenticate('admin', 'admin')
      
      get '/' do
        puts @@db1
        @coll= @@db1.collection('tweets')
        @cursor= @coll.find({}, :fields => ['_id']).limit(2)
        @results= @cursor.to_a();
        JSON.dump(@results)
      end
      

      ------------------------------------------ Data population script from console

      use tweet
      db.tweets.drop();
      
      for(var i=0;i<200;i++){
        print(i)
        db.tweets.insert({account_id:new ObjectId(), avg_ctr:Math.random(), published:new Date() })
      }
      

      ------------------------------------------ Steps to reproduce
      1. Boot up mongod in auth mode
      2. Run the console script to set up a database with some test data
      3. Set up the user for the 'tweet' db using

      use tweet
      db.addUser('admin', 'admin')

      4. start the application

      ruby server.rb (or where you stored the file)

      5. Hit the url with your browser or curl a couple of times

      http://localhost:4567

      6. Go to the mongo console and do

      db.serverStatus()['cursors']

      You will see the number of open cursor increase and hang around until they time out. This does not seem to happen if you run against the server on localhost or without auth.

        1. ruby_server.log
          3 kB
        2. server.log
          27 kB

            Assignee:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            christkv Christian Amor Kvalheim
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: