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

comparison of Fixnum with nil failed with batch insert using ReplicaSetClient and threads.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.10.1
    • Affects Version/s: 1.10.0
    • Component/s: Replica Set
    • None
    • Environment:
      ruby 2.0.0-p451

      I'm seeing exceptions raised when using threads and batch insert with the Replicasetclient

      $ ./mongo_thread_bug.rb 
      /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection_writer.rb:61:in `<': comparison of Fixnum with nil failed (ArgumentError)
      	from /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection_writer.rb:61:in `block in batch_write_incremental'
      	from /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection_writer.rb:57:in `catch'
      	from /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection_writer.rb:57:in `batch_write_incremental'
      	from /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection.rb:1158:in `batch_write'
      	from /Users/alextomlins/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/mongo-1.10.0/lib/mongo/collection.rb:411:in `insert'
      	from ./bug.rb:16:in `block in <main>'
      

      I've created a minimal test case that exposes this: https://gist.github.com/alext/477f1eb13a90860de2bf

      Note: if a read is done within the thread before doing the batch insert, it works fine.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            alex.tomlins@digital.cabinet-office.gov.uk Alex Tomlins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: