Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1029

Interrupt of query makes mongo driver return empty result sets

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.0
    • Affects Version/s: 2.1.0
    • Component/s: Public API
    • None
    • Environment:
      Linux
      Mongo 3, wiredTiger

      Run long operation and interrupt

      client = Mongo::Client.new(ENV["MONGODB_URI"])
      client[:locations].find.distinct :zip 
      ^C
      client[:locations].find.count 
      

      Depending when interruption was occured I occur 2 kind of errros.
      1. Mixed response
      first time:

      client[:locations].find.count => 0

      second time:

      client[:locations].find.count => 758299

      next:

      client[:locations].find.count => 758299

      But after I run different operation
      first time:

      client[:locations].find.first => {"n"=>758299, "ok"=>1.0}

      second time:

      client[:locations].find.first =>{"_id"=>BSON::ObjectId('554b4ede69702d60b3000000'), ...}

      Then running count again gives 0 and then good count.

      2. KeyError: key not found: "7", KeyError: key not found: "9", ...., KeyError: key not found: "a", KeyError: key not found: "o" and so on after each call.

      Stack trace is

      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bson-3.2.1/lib/bson/registry.rb:43:in `fetch'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bson-3.2.1/lib/bson/registry.rb:43:in `get'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bson-3.2.1/lib/bson/hash.rb:79:in `from_bson'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/dbref.rb:103:in `from_bson'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/serializers.rb:166:in `deserialize'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:234:in `block in deserialize_array'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:234:in `times'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:234:in `deserialize_array'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:87:in `block in deserialize'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:85:in `each'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/protocol/message.rb:85:in `deserialize'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/server/connectable.rb:88:in `block in read'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/server/connectable.rb:73:in `ensure_connected'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/server/connectable.rb:88:in `read'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/server/connection.rb:146:in `deliver'
      	from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mongo-2.1.0.rc0/lib/mongo/server/connection.rb:110:in `block in dispatch'
      

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            rull_orion Ruslan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: