-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:Mac OS X, Ruby 1.9.1-p129
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I'm investigating an issue with the Ruby driver (on Rails and Sinatra).
It only reveals itself when the web server is under significant load.
I tried jnunemaker's MongoMapper as well as the activerecord-mongo-adapter.
All is well when testing with ab like this:
ab -n 1000 http://my-ruby-project-with-mongodb/
However, increasing the concurrency to everything > 1 like ...
ab -n 1000 -c 2 http://my-ruby-project-with-mongodb/
... leads to the following error within a few seconds:
RuntimeError (Unknown type 49, key = ):
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/util/bson.rb:227:in `deserialize'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:208:in `object_from_stream'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:187:in `next_object_on_wire'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:148:in `read_objects_off_wire'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:144:in `read_all'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:219:in `block in send_query_if_needed'
<internal:prelude>:8:in `synchronize'
/usr/local/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/db.rb:543:in `_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:216:in `send_query_if_needed'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:191:in `refill_via_get_more'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:170:in `num_remaining'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:178:in `more?'
/usr/local/lib/ruby/gems/1.9.1/gems/mongodb-mongo-0.14/lib/mongo/cursor.rb:83:in `each'
app/controllers/rates_controller.rb:23:in `to_a'
app/controllers/rates_controller.rb:23:in `block (2 levels) in index'
app/controllers/rates_controller.rb:22:in `index'
haml (2.2.3) lib/sass/plugin/rails.rb:19:in `process'
<internal:prelude>:8:in `synchronize'
passenger (2.2.5) lib/phusion_passenger/rack/request_handler.rb:95:in `process_request'
The log is from 0.14, but I tried with 0.14.1 as well.