Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4196

Atomic operations sometimes fail in heavily concurrent environments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.1.0
    • Component/s: None
    • Labels:
    • Environment:
      jruby 9.0.1.0, celluloid 0.16.0

      Description

      When using Mongoid in heavily concurrent parts of my app, I often run into this issue. Calling document.set(field_name: 1) sometimes triggers this error:

      NoMethodError: undefined method `reject' for nil:NilClass

      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/clients/options.rb" line 54 in mongo_client
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/clients.rb" line 94 in mongo_client
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/clients.rb" line 90 in collection
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable.rb" line 212 in persist_atomic_operations
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable.rb" line 195 in persist_or_delay_atomic_operation
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable.rb" line 146 in prepare_atomic_operation
      • File "/home/app/vendor/bundle/jruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable/settable.rb" line 23 in set

      Calling document.with({}).set(field_name: 1) seems to fix the issue.

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            fedenusy13 Federico Nusymowicz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: