{"action":"created","issue":{"url":"https://api.github.com/repos/mongoid/mongoid/issues/4093","labels_url":"https://api.github.com/repos/mongoid/mongoid/issues/4093/labels{/name}","comments_url":"https://api.github.com/repos/mongoid/mongoid/issues/4093/comments","events_url":"https://api.github.com/repos/mongoid/mongoid/issues/4093/events","html_url":"https://github.com/mongoid/mongoid/issues/4093","id":86177950,"number":4093,"title":"Mongoid is blocked when mongo server restart","user":{"login":"rkyrychuk","id":25033,"avatar_url":"https://avatars.githubusercontent.com/u/25033?v=3","gravatar_id":"","url":"https://api.github.com/users/rkyrychuk","html_url":"https://github.com/rkyrychuk","followers_url":"https://api.github.com/users/rkyrychuk/followers","following_url":"https://api.github.com/users/rkyrychuk/following{/other_user}","gists_url":"https://api.github.com/users/rkyrychuk/gists{/gist_id}","starred_url":"https://api.github.com/users/rkyrychuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkyrychuk/subscriptions","organizations_url":"https://api.github.com/users/rkyrychuk/orgs","repos_url":"https://api.github.com/users/rkyrychuk/repos","events_url":"https://api.github.com/users/rkyrychuk/events{/privacy}","received_events_url":"https://api.github.com/users/rkyrychuk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mongoid/mongoid/milestones/72","html_url":"https://github.com/mongoid/mongoid/milestones/5.0.0","labels_url":"https://api.github.com/repos/mongoid/mongoid/milestones/72/labels","id":429552,"number":72,"title":"5.0.0","description":"Integration with 10gen Ruby driver. Bug Fixes. No new features.","creator":{"login":"durran","id":9030,"avatar_url":"https://avatars.githubusercontent.com/u/9030?v=3","gravatar_id":"","url":"https://api.github.com/users/durran","html_url":"https://github.com/durran","followers_url":"https://api.github.com/users/durran/followers","following_url":"https://api.github.com/users/durran/following{/other_user}","gists_url":"https://api.github.com/users/durran/gists{/gist_id}","starred_url":"https://api.github.com/users/durran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/durran/subscriptions","organizations_url":"https://api.github.com/users/durran/orgs","repos_url":"https://api.github.com/users/durran/repos","events_url":"https://api.github.com/users/durran/events{/privacy}","received_events_url":"https://api.github.com/users/durran/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":52,"state":"open","created_at":"2013-09-17T09:14:09Z","updated_at":"2015-06-17T14:51:08Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2015-06-08T13:30:27Z","updated_at":"2015-06-17T14:51:08Z","closed_at":"2015-06-17T14:51:08Z","body":"Mongoid is totally blocked when server restarts.\r\nLooks like timeout option is not working.\r\n```RUBY\r\n# Gemfile\r\ngem 'mongoid', github: \"mongoid/mongoid\", branch: \"master\"\r\n```\r\n\r\n```RUBY \r\n#mongo_test.rb\r\nrequire 'mongoid'\r\nclass Product\r\n  include Mongoid::Document\r\n  field :name,  type: String\r\nend\r\n\r\nMongoid.load! \"mongoid.yml\", :development\r\nProduct.destroy_all\r\nProduct.create(name: \"Mongo test\")\r\n\r\nwhile true\r\n  print Product.all.first.name\r\n  sleep 1\r\nend\r\n```\r\n```YAML\r\n#mongoid.yml\r\ndevelopment:\r\n  clients:\r\n    default:\r\n      uri: \"mongodb://localhost/mongo_test\"\r\n      options:\r\n        read:\r\n          mode: :primary\r\n        server_selection_timeout: 10\r\n        socket_timeout: 5\r\n```\r\nWhen mongo server restart, code just blocked, not reconnects, no errors.\r\n\r\nStacktrace on break:\r\n```\r\n, [2015-06-08T13:13:54.522779 #31341] DEBUG -- : MONGODB | QUERY | namespace=mongo_test.products selector={} flags=[] limit=0 skip=0 project=nil | runtime: 158644.8395ms\r\nD, [2015-06-08T13:13:54.523294 #31341] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 151666.8334ms\r\n/home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/socket.rb:161:in `read': Interrupt\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/socket.rb:161:in `read_from_socket'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/socket.rb:126:in `block in read'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/socket.rb:173:in `handle_errors'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/socket.rb:123:in `read'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/protocol/serializers.rb:62:in `deserialize'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/protocol/message.rb:193:in `deserialize_header'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/protocol/message.rb:83:in `deserialize'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connectable.rb:110:in `block in read'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connectable.rb:95:in `ensure_connected'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connectable.rb:110:in `read'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connectable.rb:67:in `block in dispatch'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/loggable.rb:44:in `log'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/loggable.rb:65:in `log_debug'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connectable.rb:65:in `dispatch'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/operation/read/query.rb:61:in `block in execute_message'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/connection_pool.rb:99:in `with_connection'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/server/context.rb:63:in `with_connection'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/operation/read/query.rb:60:in `execute_message'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/operation/read/query.rb:54:in `execute'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/collection/view.rb:164:in `send_initial_query'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/mongo-2.0.4/lib/mongo/collection/view/iterable.rb:39:in `each'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/query_cache.rb:207:in `each'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/contextual/mongo.rb:240:in `first'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/contextual/mongo.rb:240:in `block in first'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/contextual/mongo.rb:489:in `try_cache'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/contextual/mongo.rb:239:in `first'\r\n\tfrom /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/mongoid-2f806d1d38b4/lib/mongoid/contextual.rb:20:in `first'\r\n\tfrom ./mongo_test.rb:12:in `<main>'\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mongoid/mongoid/issues/comments/112829780","html_url":"https://github.com/mongoid/mongoid/issues/4093#issuecomment-112829780","issue_url":"https://api.github.com/repos/mongoid/mongoid/issues/4093","id":112829780,"user":{"login":"durran","id":9030,"avatar_url":"https://avatars.githubusercontent.com/u/9030?v=3","gravatar_id":"","url":"https://api.github.com/users/durran","html_url":"https://github.com/durran","followers_url":"https://api.github.com/users/durran/followers","following_url":"https://api.github.com/users/durran/following{/other_user}","gists_url":"https://api.github.com/users/durran/gists{/gist_id}","starred_url":"https://api.github.com/users/durran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/durran/subscriptions","organizations_url":"https://api.github.com/users/durran/orgs","repos_url":"https://api.github.com/users/durran/repos","events_url":"https://api.github.com/users/durran/events{/privacy}","received_events_url":"https://api.github.com/users/durran/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T14:51:08Z","updated_at":"2015-06-17T14:51:08Z","body":"Excellent - thanks!"}}