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

A EOFError occurred, A NoMethodError occurred, A Moped::Errors::OperationFailure occurred

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.15
    • Affects Version/s: None
    • Component/s: None

      Getting weird errors lately:

      A NoMethodError occurred in photos#create:
      
       undefined method `[]' for nil:NilClass
       moped (1.2.1) lib/moped/node.rb:74:in `block in command'
      
      Backtrace:
      -------------------------------
      
       moped (1.2.1) lib/moped/node.rb:74:in `block in command'
       moped (1.2.1) lib/moped/node.rb:521:in `[]'
       moped (1.2.1) lib/moped/node.rb:521:in `block (3 levels) in flush'
       moped (1.2.1) lib/moped/node.rb:520:in `map'
       moped (1.2.1) lib/moped/node.rb:520:in `block (2 levels) in flush'
       moped (1.2.1) lib/moped/node.rb:123:in `ensure_connected'
       moped (1.2.1) lib/moped/node.rb:516:in `block in flush'
       moped (1.2.1) lib/moped/node.rb:531:in `logging'
       moped (1.2.1) lib/moped/node.rb:515:in `flush'
       moped (1.2.1) lib/moped/node.rb:286:in `pipeline'
       moped (1.2.1) lib/moped/session/context.rb:58:in `block in insert'
       moped (1.2.1) lib/moped/session/context.rb:109:in `block in with_node'
       moped (1.2.1) lib/moped/cluster.rb:150:in `block in with_primary'
       moped (1.2.1) lib/moped/node.rb:168:in `ensure_primary'
       moped (1.2.1) lib/moped/cluster.rb:149:in `with_primary'
       moped (1.2.1) lib/moped/session/context.rb:108:in `with_node'
       moped (1.2.1) lib/moped/session/context.rb:56:in `insert'
       moped (1.2.1) lib/moped/collection.rb:91:in `block in insert'
       moped (1.2.1) lib/moped/session.rb:305:in `with'
       moped (1.2.1) lib/moped/collection.rb:90:in `insert'
       mongoid (3.0.5) lib/mongoid/persistence/operations/insert.rb:27:in `block in persist'
       mongoid (3.0.5) lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
       activesupport (3.2.8) lib/active_support/callbacks.rb:425:in `_run__26432495077089874__create__1084678567495970683__callbacks'
       activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
       activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
       activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
       mongoid (3.0.5) lib/mongoid/callbacks.rb:100:in `run_callbacks'
       mongoid (3.0.5) lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
       activesupport (3.2.8) lib/active_support/callbacks.rb:436:in `_run__26432495077089874__save__1084678567495970683__callbacks'
       activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
       activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
       activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
       mongoid (3.0.5) lib/mongoid/callbacks.rb:100:in `run_callbacks'
       mongoid (3.0.5) lib/mongoid/persistence/insertion.rb:23:in `prepare'
       mongoid (3.0.5) lib/mongoid/persistence/operations/insert.rb:26:in `persist'
       mongoid (3.0.5) lib/mongoid/persistence.rb:50:in `insert'
       mongoid (3.0.5) lib/mongoid/persistence.rb:79:in `save'
       app/controllers/api/photos_controller.rb:34:in `create'
      

      and

      A EOFError occurred in photos#index:
      
       end of file reached
       moped (1.2.1) lib/moped/bson/extensions/hash.rb:12:in `readbyte'
      
      Backtrace:
      -------------------------------
      
       moped (1.2.1) lib/moped/bson/extensions/hash.rb:12:in `readbyte'
       moped (1.2.1) lib/moped/bson/extensions/hash.rb:12:in `__bson_load__'
       moped (1.2.1) lib/moped/bson/document.rb:7:in `deserialize'
       moped (1.2.1) lib/moped/connection.rb:106:in `block (2 levels) in read'
       moped (1.2.1) lib/moped/connection.rb:105:in `times'
       moped (1.2.1) lib/moped/connection.rb:105:in `each'
       moped (1.2.1) lib/moped/connection.rb:105:in `map'
       moped (1.2.1) lib/moped/connection.rb:105:in `block in read'
       moped (1.2.1) lib/moped/connection.rb:169:in `with_connection'
       moped (1.2.1) lib/moped/connection.rb:86:in `read'
       moped (1.2.1) lib/moped/protocol/query.rb:140:in `receive_replies'
       moped (1.2.1) lib/moped/connection.rb:125:in `block in receive_replies'
       moped (1.2.1) lib/moped/connection.rb:124:in `map'
       moped (1.2.1) lib/moped/connection.rb:124:in `receive_replies'
       moped (1.2.1) lib/moped/node.rb:518:in `block (2 levels) in flush'
       moped (1.2.1) lib/moped/node.rb:123:in `ensure_connected'
       moped (1.2.1) lib/moped/node.rb:516:in `block in flush'
       moped (1.2.1) lib/moped/node.rb:531:in `logging'
       moped (1.2.1) lib/moped/node.rb:515:in `flush'
       moped (1.2.1) lib/moped/node.rb:504:in `process'
       moped (1.2.1) lib/moped/node.rb:343:in `query'
       moped (1.2.1) lib/moped/cursor.rb:116:in `block in load_docs'
       moped (1.2.1) lib/moped/session/context.rb:109:in `block in with_node'
       moped (1.2.1) lib/moped/cluster.rb:150:in `block in with_primary'
       moped (1.2.1) lib/moped/node.rb:168:in `ensure_primary'
       moped (1.2.1) lib/moped/cluster.rb:149:in `with_primary'
       moped (1.2.1) lib/moped/session/context.rb:108:in `with_node'
       moped (1.2.1) lib/moped/cursor.rb:115:in `load_docs'
       moped (1.2.1) lib/moped/cursor.rb:25:in `each'
       moped (1.2.1) lib/moped/query.rb:77:in `each'
       moped (1.2.1) lib/moped/query.rb:77:in `each'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:134:in `block in each'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:633:in `selecting'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:133:in `each'
       mongoid (3.0.5) lib/mongoid/contextual.rb:18:in `each'
       mongoid (3.0.5) lib/mongoid/relations/referenced/in.rb:139:in `eager_load'
       mongoid (3.0.5) lib/mongoid/relations/metadata.rb:216:in `eager_load'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:537:in `block in eager_load'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:536:in `reject!'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:536:in `eager_load'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:518:in `documents_for_iteration'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:134:in `block in each'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:633:in `selecting'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:133:in `each'
       mongoid (3.0.5) lib/mongoid/contextual.rb:18:in `each'
       app/controllers/api/photos_controller.rb:8:in `map'
      

      and a lot of errors like this:

      A Moped::Errors::OperationFailure occurred in photos#create:
      
       The operation: #<Moped::Protocol::Command
       @length=58
       @request_id=187
       @response_to=0
       @op_code=2004
       @flags=[]
       @full_collection_name="admin.$cmd"
       @skip=0
       @limit=-1
       @selector={:ismaster=>1}
       @fields=nil>
      failed with error nil
       moped (1.2.1) lib/moped/node.rb:74:in `block in command'
      
      Backtrace:
      -------------------------------
      
       moped (1.2.1) lib/moped/node.rb:74:in `block in command'
       moped (1.2.1) lib/moped/node.rb:521:in `[]'
       moped (1.2.1) lib/moped/node.rb:521:in `block (3 levels) in flush'
       moped (1.2.1) lib/moped/node.rb:520:in `map'
       moped (1.2.1) lib/moped/node.rb:520:in `block (2 levels) in flush'
       moped (1.2.1) lib/moped/node.rb:123:in `ensure_connected'
       moped (1.2.1) lib/moped/node.rb:516:in `block in flush'
       moped (1.2.1) lib/moped/node.rb:531:in `logging'
       moped (1.2.1) lib/moped/node.rb:515:in `flush'
       moped (1.2.1) lib/moped/node.rb:504:in `process'
       moped (1.2.1) lib/moped/node.rb:70:in `command'
       moped (1.2.1) lib/moped/node.rb:366:in `refresh'
       moped (1.2.1) lib/moped/cluster.rb:112:in `block in refresh'
       moped (1.2.1) lib/moped/cluster.rb:125:in `each'
       moped (1.2.1) lib/moped/cluster.rb:125:in `refresh'
       moped (1.2.1) lib/moped/cluster.rb:78:in `nodes'
       moped (1.2.1) lib/moped/cluster.rb:147:in `with_primary'
       moped (1.2.1) lib/moped/session/context.rb:108:in `with_node'
       moped (1.2.1) lib/moped/session/context.rb:43:in `query'
       moped (1.2.1) lib/moped/query.rb:109:in `first'
       mongoid (3.0.5) lib/mongoid/contextual/mongo.rb:202:in `first'
       mongoid (3.0.5) lib/mongoid/contextual.rb:18:in `first'
       orm_adapter (0.4.0) lib/orm_adapter/adapters/mongoid.rb:28:in `find_first'
       devise (2.1.2) lib/devise/models/authenticatable.rb:222:in `find_first_by_auth_conditions'
       devise (2.1.2) lib/devise/models/authenticatable.rb:218:in `find_for_authentication'
       /usr/home/test/app/shared/bundle/ruby/1.9/gems/devise-2.1.2/lib/devise/models/token_authenticatable.rb:65:in `find_for_token_authentication'
       app/controllers/api_controller.rb:21:in `authenticate'
      

      Setup is:
      FreeBSD 9.0-RELEASE
      Ruby: ruby 1.9.3p194 (2012-04-20 revision 35410) [amd64-freebsd9]
      Mongodb: db version v2.0.6
      Server: 4 unicorn instances behind nginx, with "upgrade" restart (preload_app true). But restarting unicorn by stopping and starting doesn't solve the problem.

      bundle list:

      Gems included by the bundle:
        * actionmailer (3.2.9)
        * actionpack (3.2.9)
        * activemodel (3.2.9)
        * activerecord (3.2.9)
        * activeresource (3.2.9)
        * activesupport (3.2.9)
        * addressable (2.3.2)
        * arel (3.0.2)
        * bcrypt-ruby (3.0.1)
        * builder (3.0.4)
        * bundler (1.2.1)
        * chronic (0.8.0)
        * cocaine (0.4.2)
        * dalli (2.5.0)
        * devise (2.1.2)
        * diff-lcs (1.1.3)
        * erubis (2.7.0)
        * eventmachine (1.0.0)
        * exception_notification (3.0.0)
        * factory_girl (4.1.0)
        * factory_girl_rails (4.1.0)
        * faraday (0.8.4)
        * faraday_middleware (0.9.0)
        * hashie (1.2.0)
        * hike (1.2.1)
        * http_parser.rb (0.5.3)
        * httpauth (0.2.0)
        * i18n (0.6.1)
        * journey (1.0.4)
        * jquery-rails (2.1.3)
        * json (1.7.5)
        * json_expressions (0.8.1)
        * jwt (0.1.5)
        * kaminari (0.14.1)
        * kgio (2.7.4)
        * launchy (2.1.2)
        * letter_opener (1.0.0)
        * mail (2.4.4)
        * mime-types (1.19)
        * mina (0.2.1 00f773c)
        * mongoid (3.0.13)
        * moped (1.3.0)
        * multi_json (1.3.7)
        * multipart-post (1.1.5)
        * oauth (0.4.7)
        * oauth2 (0.8.0)
        * omniauth (1.1.1)
        * omniauth-facebook (1.4.1)
        * omniauth-oauth (1.0.1)
        * omniauth-oauth2 (1.1.1)
        * omniauth-twitter (0.0.14)
        * omniauth-vkontakte (1.1.1)
        * open4 (1.3.0)
        * origin (1.0.10)
        * orm_adapter (0.4.0)
        * paperclip (3.3.1)
        * polyglot (0.3.3)
        * rack (1.4.1)
        * rack-cache (1.2)
        * rack-ssl (1.3.2)
        * rack-test (0.6.2)
        * rails (3.2.9)
        * railties (3.2.9)
        * raindrops (0.10.0)
        * rake (10.0.2)
        * rdoc (3.12)
        * redis (3.0.2)
        * redis-actionpack (3.2.3)
        * redis-activesupport (3.2.3)
        * redis-rack (1.4.2)
        * redis-rails (3.2.3)
        * redis-store (1.1.3)
        * rspec-core (2.12.0)
        * rspec-expectations (2.12.0)
        * rspec-mocks (2.12.0)
        * rspec-rails (2.12.0)
        * simple_oauth (0.1.9)
        * simplecov (0.7.1)
        * simplecov-html (0.7.1)
        * sprockets (2.2.1)
        * thor (0.16.0)
        * tilt (1.3.3)
        * tinder (1.9.1)
        * treetop (1.4.12)
        * twitter-stream (0.1.16)
        * tzinfo (0.3.35)
        * unicorn (4.4.0)
        * warden (1.2.1)
        * whenever (0.8.0)
        * yajl-ruby (1.1.0)
      

      What the hell is going on and what is the problem with Moped again?..

            Assignee:
            Unassigned Unassigned
            Reporter:
            alfuken alfuken
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: