We have a rails 4 app in production environment, on a webrick server, that crashes regularly and returns a 500 error. The crash seems to come from the following error :
Error during failsafe response: undefined method `authenticate' for nil:NilClass
/usr/local/rvm/gems/ruby-2.1.2/gems/devise-3.2.2/lib/devise/controllers/helpers.rb:58:in `current_user'
We've checked the helpers.rb file at line 58, and so it comes from a call to wardent.authenticate in the 'current_user' method. So we've imported the gem 'warden' in our Gemfile, but nothing changes.
We also tried to change the webrick server into a 'puma' server, thinking it could come from threads, but nothing changed...
The entire error is the following :
Error during failsafe response: undefined method `authenticate' for nil:NilClass
/usr/local/rvm/gems/ruby-2.1.2/gems/devise-3.2.2/lib/devise/controllers/helpers.rb:58:in `current_user'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/helpers.rb:53:in `current_user'
/home/dev/myProject/app/views/shared/_top_menu.html.erb:23:in `_app_views_shared__top_menu_html_erb___3475115451092967008_67265400'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:143:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:161:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:141:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:278:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:47:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/helpers/rendering_helper.rb:27:in `render'
/home/dev/myProject/app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__2013404122424653986_65265180'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:143:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:161:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:141:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:17:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:42:in `render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:23:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:127:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:120:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:33:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/renderers.rb:26:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:97:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:16:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/core_ext/benchmark.rb:12:in `ms'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/activerecord-4.0.11/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:40:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/base.rb:189:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/callbacks.rb:403:in `_run__2818342425517875908__process_action__callbacks'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/callbacks.rb:80:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activerecord-4.0.11/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/base.rb:136:in `process'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:44:in `process'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal.rb:195:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal.rb:231:in `block in action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:82:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:50:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:71:in `block in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:59:in `each'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:59:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:676:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:43:in `render_exception'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:33:in `rescue in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:20:in `block in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:26:in `tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:68:in `tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:20:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/static.rb:84:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/engine.rb:511:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/application.rb:97:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Error during failsafe response: undefined method `authenticate' for nil:NilClass
/usr/local/rvm/gems/ruby-2.1.2/gems/devise-3.2.2/lib/devise/controllers/helpers.rb:58:in `current_user'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/helpers.rb:53:in `current_user'
/home/dev/myProject/app/views/shared/_top_menu.html.erb:23:in `_app_views_shared__top_menu_html_erb___3475115451092967008_68619440'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:143:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:161:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:141:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/partial_renderer.rb:278:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:47:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/helpers/rendering_helper.rb:27:in `render'
/home/dev/myProject/app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__2013404122424653986_65265180'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:143:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:161:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/template.rb:141:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/template_renderer.rb:17:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:42:in `render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_view/renderer/renderer.rb:23:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:127:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:120:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:33:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/renderers.rb:26:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:97:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:16:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/core_ext/benchmark.rb:12:in `ms'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/activerecord-4.0.11/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:40:in `render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/base.rb:189:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/callbacks.rb:403:in `_run__2818342425517875908__process_action__callbacks'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/callbacks.rb:80:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/notifications.rb:159:in `instrument'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/activerecord-4.0.11/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/base.rb:136:in `process'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/abstract_controller/rendering.rb:44:in `process'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal.rb:195:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_controller/metal.rb:231:in `block in action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:82:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:50:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:71:in `block in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:59:in `each'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/journey/router.rb:59:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/routing/route_set.rb:676:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:43:in `render_exception'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:33:in `rescue in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:20:in `block in call'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:26:in `tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/tagged_logging.rb:68:in `tagged'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/rack/logger.rb:20:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.0.11/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.0.11/lib/action_dispatch/middleware/static.rb:84:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/engine.rb:511:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/application.rb:97:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
[2014-11-07 13:06:52] FATAL SignalException: SIGTERM
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:170:in `select'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:170:in `block in start'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:32:in `start'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:160:in `start'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
/usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/commands/server.rb:84:in `start'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/commands.rb:76:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/commands.rb:71:in `tap'
/usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.0.11/lib/rails/commands.rb:71:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
[2014-11-07 13:06:52] INFO going to shutdown ...
[2014-11-07 13:06:52] INFO WEBrick::HTTPServer#start done.
Processing by ErrorsController#internal_server_error as HTML
Rendered errors/internal_server_error.html.erb within layouts/application (0.3ms)
Rendered shared/_top_menu.html.erb (1.4ms)
Completed 500 Internal Server Error in 3ms
Does anyone has an idea of where it could come from ?
Update
An other error happens just before the error detailed up in this post, here is the error :
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)):
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `block in wait_poll'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `loop'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `wait_poll'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:136:in `block in poll'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:146:in `synchronize'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:134:in `poll'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:423:in `acquire_connection'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
activerecord (4.0.11) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
activerecord (4.0.11) lib/active_record/connection_handling.rb:53:in `connection'
activerecord (4.0.11) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings'
activerecord (4.0.11) lib/active_record/query_cache.rb:43:in `rescue in call'
activerecord (4.0.11) lib/active_record/query_cache.rb:32:in `call'
activerecord (4.0.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.11) lib/active_support/callbacks.rb:373:in `_run__2890043484802466369__call__callbacks'
activesupport (4.0.11) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.11) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.11) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.11) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.0.11) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.0.11) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.0.11) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.11) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
actionpack (4.0.11) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.11) lib/rails/engine.rb:511:in `call'
railties (4.0.11) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Update 2
I've added the 'puma' gem to the Gemfile to enable the puma multi-threading server, and added the following config/initializers/database_connection.rb :
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = ActiveRecord::Base.configurations[Rails.env] ||
Rails.application.config.database_configuration[Rails.env]
config['pool'] = ENV['DB_POOL'] || ENV['MAX_THREADS'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
But the error still occurs...
Solution !
We've deployed an Apache Server, with Capistrano and Phusion Passenger. Since this time, everything works well, no problems with Rails, or devise, or anything else. I think the problem was we trusted the default Webrick server to work in a production environment, whereas it's intended to work only for development environments...
Thanks to all for your help and your advises