Websocket Rails deadlocking issue - ruby-on-rails

Having an issue in a Rails 4 app where I'm getting a deadlock error (details below). I'm using the 'websocket-rails' gem.
It seems to be happening on every 2nd request, coming from dispatcher = new WebSocketRails('localhost:3000/websocket'); (from the front-end of my app)
I've seen little to no mention of this issue except for an older issue within the faye repo on github: https://github.com/faye/faye/issues/190
Error:
Started GET "/websocket" for 127.0.0.1 at 2014-10-20 00:26:38 -0700
#<ActionDispatch::Request:0x007fae697e4a18>
Unexpected error while processing request: deadlock; recursive locking
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:16:in `lock'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:16:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.1.6/lib/action_dispatch/middleware/static.rb:64:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/engine.rb:514:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/application.rb:144:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/faye-websocket-0.7.5/lib/faye/adapters/thin.rb:40:in `process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/faye-websocket-0.7.5/lib/faye/adapters/thin.rb:44:in `receive_data'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/server.rb:69:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `tap'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `server'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
/Users/userme/Desktop/rdio-client-v2/server/bin/rails:8:in `require'
/Users/userme/Desktop/rdio-client-v2/server/bin/rails:8:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/userme/Desktop/rdio-client-v2/server/bin/spring:16:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Adding
config.middleware.delete Rack::Lock
to application.rb should help.

Related

Rails console only - Classes don't load (uninitialized constant)

I am having the weirdest error. SOMETIMES (usually after a code push), I will SSH into our production RoR servers and load up a console. When that happens, I get a crazy NameError error, then I try again and the console loads, but I cant use any of my classes
ubuntu#ip-10-0-1-10 /v/w/numanage> rails c -e production
/home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:268:in `const_get': uninitialized constant AdminUser
Did you mean? Admin (NameError)
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:268:in `block in constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `inject'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:583:in `get'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:614:in `constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise.rb:301:in `get'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/mapping.rb:81:in `to'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/mapping.rb:76:in `modules'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/mapping.rb:93:in `routes'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/mapping.rb:160:in `default_used_route'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/mapping.rb:70:in `initialize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise.rb:331:in `new'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise.rb:331:in `add_mapping'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:241:in `block in devise_for'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:240:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:240:in `devise_for'
from /var/www/numanage/config/routes.rb:12:in `block in <top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `instance_exec'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `eval_block'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:371:in `draw'
from /var/www/numanage/config/routes.rb:1:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `load'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/file_update_checker.rb:77:in `execute'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:7:in `execute'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:132:in `block (2 levels) in <module:Finisher>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `instance_exec'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `block in make_lambda'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `catch'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `block in default_terminator'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:170:in `block in halting'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `block in call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_run_callbacks'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/execution_wrapper.rb:99:in `run!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:113:in `run!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:48:in `block (2 levels) in reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:46:in `tap'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:46:in `block in reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/execution_wrapper.rb:76:in `wrap'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:45:in `reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:154:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
ubuntu#ip-10-0-1-10 /v/w/numanage> rails c -e production
Running via Spring preloader in process 4926
Loading production environment (Rails 5.0.0.1)
2.3.1 :001 > User
NameError: uninitialized constant User
from (irb):2
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /var/www/numanage/bin/rails:9:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `load'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1#numanage/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
2.3.1 :003 >
The really crazy part is, the puma server starts up just fine and acts like nothings wrong
I'm really at a lost to even debug this, let me know if y'all have any ideas
EDIT:
We are using the devise and ActiveAdmin gems, so the routes.rb:12 is as follows
devise_for :admin_users, ActiveAdmin::Devise.config
It looks like devise is loading out AdminUser (ActiveRecord model), which is failing for some unknown reason

Unexpected error while processing request: invalid byte sequence in UTF-8 #

when enable rack-mini-profiler gem, it gives error
Unexpected error while processing request: invalid byte sequence in UTF-8
using
Rails v4.0.6
rack-mini-profiler 0.10.1
Ruby 2.2.0
only happen if enable rake-mini-profiler, otherwise application working fine.
backtrace:
Unexpected error while processing request: invalid byte sequence in UTF-8
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/client_settings.rb:24:in `split'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/client_settings.rb:24:in `initialize'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/profiler.rb:153:in `new'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/profiler.rb:153:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/engine.rb:511:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/application.rb:97:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/content_length.rb:14:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:86:in `block in pre_process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `catch'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `pre_process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:53:in `process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:39:in `receive_data'
/home/aa/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run_machine'
/home/aa/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/backends/base.rb:73:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/server.rb:162:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/handler/thin.rb:16:in `run'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:264:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands/server.rb:84:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:76:in `block in <top (required)>'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:71:in `tap'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:71:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
I'm not sure, i think this error keep coming after 'Slim-Rails' gem
just added
gem "handle_invalid_percent_encoding_requests"
working fine !
solution from https://stackoverflow.com/a/24894410/3212137

NoMethodError in undefined method `scoped' in rails (using ancestry gem)

I am using the ancestry gem and i m testing my model in the console first.When i use
root = Message.create(:content => "hello")
It inserts data into the database but when i use
child = root.children.create(:content => "hhjjh")
It gives an error.This is the log
NoMethodError: undefined method `scoped' for #<Class:0x007fa4a61182b0>
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/ancestry-1.2.3/lib/ancestry/instance_methods.rb:136:in `children'
from (irb):2
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Users/zeeshandar/chat/bin/rails:8:in `<top (required)>'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/zeeshandar/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/zeeshandar/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
I don't know what i m doing wrong but i think this is suppose to work.Any ideas?
It looks like your version of Ancestry is 1.2.3 or something. Updating to a new version looks like it should fix that problem.
Gemfile
gem 'ancestry', '~> 2.1'

Can't initialize local server for my Rails apps

My rails apps have been freaking out on me lately. I start my local server by running "ruby script/server" like normal. The server starts, but when I try to access it via "http://localhost:3000/", it throws me a 500 error. This happens for all my rails apps, even the old ones I've left unchanged for several months now. Here is the full trace:
/!\ FAILSAFE /!\ 2010-02-17 23:34:46 -0800
Status: 500 Internal Server Error
uninitialized constant FFI::Platform::CPU
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `rescue in load_missing_constant'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:436:in `load_missing_constant'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing_with_dependencies'
/Users/elpizochoi/.gem/ruby/1.9.1/gems/ffi-0.6.2/lib/ffi/platform.rb:50:in `<module:Platform>'
/Users/elpizochoi/.gem/ruby/1.9.1/gems/ffi-0.6.2/lib/ffi/platform.rb:32:in `<module:FFI>'
/Users/elpizochoi/.gem/ruby/1.9.1/gems/ffi-0.6.2/lib/ffi/platform.rb:29:in `<top (required)>'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/elpizochoi/.gem/ruby/1.9.1/gems/ffi-0.6.2/lib/ffi/ffi.rb:42:in `<top (required)>'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/elpizochoi/.gem/ruby/1.9.1/gems/ffi-0.6.2/lib/ffi.rb:11:in `<top (required)>'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/sqlite3-0.0.8/lib/sqlite3.rb:1:in `<top (required)>'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/requires.rb:7:in `block in require_library_or_gem'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:in `sqlite3_connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout'
/opt/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/head.rb:9:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:8:in `synchronize'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `block in call'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run'
/opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `block in call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:in `service'
/opt/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/opt/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/opt/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Configuration: I have Ruby 1.9 installed with MacPorts, and am running on Rails 2.3.5.
Some things I've been playing with recently:
- Messed with RVM
- Tried out the Homebrew, a MacOSX package management system
- Installed Unicorn and Thin as gems
Any help would be much appreciated! I'd prefer not to have to scrap my system and reinstall everything.
When I get the " uninitialized constant" error, I normally have a missing class or library, e.g. an incomplete checkout of a project or branch. In your case there might be some problems with the path/setup of FFI::Platform::CPU
BTW you are mentioning: "not to have to scrap my system and reinstall everything" --> I use git to version control my dev environment once in a while, so I can checkout the previous snapshot before the trouble got started.
good luck!

ActionController::MethodNotAllowed after reloading routes?

I have an application where I'm dynamically loading routes by a model, and calling ActionController::Routing::Routes.reload! after creating/updating that model. The problem is that after doing this, I'm receiving the following error when I try to hit that new route:
ActionController::MethodNotAllowed
Only get, head, post, put, and delete requests are allowed.
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:384:in `recognize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:148:in `handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
What's really odd is that the request has no parameters, and the response headers are {"cookie"=>[],
"Allow"=>"GET,
HEAD,
POST,
PUT,
DELETE",
"Cache-Control"=>"no-cache"}
All this even though the request is definitely GET (according to Firebug) and according to the response GET is certainly allowed.
I'm using Rails 2.1.0 and Mongrel 1.1.5 (after googling, I noticed some have problems with older versions).
Anyone have thoughts?
Apparently this was a bug in Rails 2.1.0. Upgrading to Rails 2.2.1 fixed the problem.
Upgrading to 2.1.2 also fixes this in case you don't want to potentially break your site with 2.2.

Resources