'Puma-dev and Rails s both run same version of puma but produce different results
Trying to debug a confusing issue. Upgrading an old app from Rails 3.22.xx -> 4.2.11.3.
If I run rails s the server boots up and the app loads just fine.
=> Booting Puma
=> Rails 4.2.11.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[20409] Puma starting in cluster mode...
[20409] * Puma version: 5.5.2 (ruby 2.4.0-p0) ("Zawgyi")
[20409] * Min threads: 8
[20409] * Max threads: 32
[20409] * Environment: development
[20409] * Master PID: 20409
[20409] * Workers: 2
[20409] * Restarts: (✔) hot (✖) phased
[20409] * Preloading application
[20409] * Listening on http://127.0.0.1:3000
[20409] * Listening on http://[::1]:3000
[20409] Use Ctrl-C to stop
If I use the domain set for puma-dev however, it errors out. The error is related to mongo gem and BSON serialization.
In the below code value is just something I am logging out from the mongo gem.
appName[28214]: bash: no job control in this shell
appName[28214]: Puma starting in single mode...
appName[28214]: * Puma version: 5.5.2 (ruby 2.4.0-p0) ("Zawgyi")
appName[28214]: * Min threads: 0
appName[28214]: * Max threads: 5
appName[28214]: * Environment: development
appName[28214]: * PID: 28214
appName[28214]: VALUE : {:ping=>1}
appName[28214]: VALUE :
appName[28214]: VALUE : {:ping=>1, "$db"=>"admin"}
appName[28214]: VALUE : {:ismaster=>1}
appName[28214]: VALUE :
appName[28214]: VALUE : {:ismaster=>1, "$db"=>"admin"}
appName[28214]: * Listening on unix:/Users/rockwellrice/.puma-dev/appName/tmp/puma-dev-431.sock
appName[28214]: Use Ctrl-C to stop
! App 'appName' booted
appName[28214]: VALUE : {:ismaster=>1, :compression=>[], :client=>{"driver"=>{"name"=>"mongo-ruby-driver", "version"=>"2.7.0"}, "os"=>{"type"=>"darwin", "name"=>"darwin18.7.0", "architecture"=>"x86_64"}, "platform"=>"mongoid-5.4.1, 2.4.0, x86_64-darwin18, x86_64-apple-darwin18.7.0"}}
appName[28214]: VALUE :
appName[28214]: VALUE : {"find"=>"users", "filter"=>{"_id"=>"93221de412af253e53231735"}, "limit"=>1, "singleBatch"=>true, "$db"=>"reader", "lsid"=>{"id"=><BSON::Binary:0x70235818644900 type=uuid data=0x4730a5f638de4dce...>}}
The error specifically happens when it grabs the user ID value and it returns
BSON::Error::UnserializableClass
Value does not define its BSON serialized type: 93221de412af253e53231735
I am confused why this happens when loading through puma dev but not when using Rails s and going to localhost:3000.
Ruby on rails 4.2.11.3, Mongo 2.7.0, MongoID 5.4.1.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
