rails/arel

UncaughtThrowError: uncaught throw {:__recursive_key__=>true, 19667120=>true} from visitors/reduce.rb:13

Closed this issue · 4 comments

I am getting above error from visitors/reduce.rb:13, below I have attached full backtrace of the error. The issue is occurring so randomly that, the working query in production suddenly starts breaking and starts throwing error and in the next moment it starts working fine. On tracking origin of the error, every error tracks down to line number 13 of visitors/reduce.rb file inside the gem. The UncaughtThrowError is thrown only when an exception is thrown without catch block. I tried to find whether there is any throw statement in arel gem but I could not get any.

I was also able to get parameters of the visit method at the time the error is being raised. I have also pasted them below. By looking at the arguments it seems like query was also not built completely. The error was raised while building the query itself. That partly built query is one of the query for which I am getting error. I am getting this error for any random query in the application.

Below I have pasted backtrace of the error, ruby version, Gemfile and Gemfile.lock of rails app.

Ruby version:

2.3.4

object, dispatch[object.class] in visit method at the time of error:
collector:
#<ActiveRecord::ConnectionAdapters::AbstractAdapter::BindCollector:0x007fe85a2db1b8 @Parts=["SELECT", " ", " ", "users.*", " FROM ", "users", " WHERE "]>
dispatch[object.class]:
visit_Arel_Nodes_And

Error back trace:

UncaughtThrowError: uncaught throw {:__recursive_key__=>true, 16314800=>true}
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/reduce.rb:13:in `rescue in visit'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/reduce.rb:7:in `visit'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:795:in `block in inject_join'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:793:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:793:in `each_with_index'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:793:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:793:in `inject'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:793:in `inject_join'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:650:in `visit_Arel_Nodes_And'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/reduce.rb:13:in `visit'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:255:in `block in visit_Arel_Nodes_SelectCore'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:254:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:254:in `each_with_index'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:254:in `visit_Arel_Nodes_SelectCore'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/mysql.rb:50:in `visit_Arel_Nodes_SelectCore'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:210:in `block in visit_Arel_Nodes_SelectStatement'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:209:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:209:in `inject'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:209:in `visit_Arel_Nodes_SelectStatement'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/mysql.rb:45:in `visit_Arel_Nodes_SelectStatement'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/reduce.rb:13:in `visit'
/usr/local/rvm/gems/ruby-2.3.4/gems/arel-6.0.4/lib/arel/visitors/reduce.rb:7:in `accept'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:12:in `to_sql'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/querying.rb:39:in `find_by_sql'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation.rb:638:in `exec_queries'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation.rb:514:in `load'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation.rb:243:in `to_a'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation/finder_methods.rb:500:in `find_nth_with_limit'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation/finder_methods.rb:484:in `find_nth'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/relation/finder_methods.rb:127:in `first'
/usr/local/rvm/gems/ruby-2.3.4/gems/orm_adapter-0.5.0/lib/orm_adapter/adapters/active_record.rb:17:in `get'
/usr/local/rvm/gems/ruby-2.3.4/gems/devise-3.5.4/lib/devise/models/authenticatable.rb:208:in `serialize_from_session'
/usr/local/rvm/gems/ruby-2.3.4/gems/devise-3.5.4/lib/devise.rb:465:in `block (2 levels) in configure_warden!'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/session_serializer.rb:35:in `fetch'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/proxy.rb:213:in `user'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/proxy.rb:323:in `_perform_authentication'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/proxy.rb:105:in `authenticate'
/usr/local/rvm/gems/ruby-2.3.4/gems/devise-3.5.4/lib/devise/controllers/helpers.rb:124:in `current_user'
/var/www/L.U.C.I./app/controllers/application_controller.rb:15:in `current_user_profile_pic'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:430:in `block in make_lambda'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:162:in `block in halting'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:502:in `block in call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:502:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:502:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:19:in `process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:137:in `process'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionview-4.2.3/lib/action_view/rendering.rb:30:in `process'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal.rb:196:in `dispatch'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_controller/metal.rb:237:in `block in action'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:45:in `serve'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `each'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `serve'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:821:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/omniauth-1.4.1/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.3.4/gems/omniauth-1.4.1/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/omniauth-1.4.1/lib/omniauth/builder.rb:63:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
/usr/local/rvm/gems/ruby-2.3.4/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/etag.rb:24:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/conditionalget.rb:25:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/head.rb:13:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/flash.rb:260:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:225:in `context'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:220:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/dragonfly-0.9.15/lib/dragonfly/cookie_monster.rb:9:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/query_cache.rb:36:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/dragonfly-0.9.15/lib/dragonfly/middleware.rb:13:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-cache-1.5.1/lib/rack/cache/context.rb:140:in `forward'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-cache-1.5.1/lib/rack/cache/context.rb:249:in `fetch'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-cache-1.5.1/lib/rack/cache/context.rb:189:in `lookup'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-cache-1.5.1/lib/rack/cache/context.rb:66:in `call!'
/usr/local/rvm/gems/ruby-2.3.4/gems/rack-cache-1.5.1/lib/rack/cache/context.rb:51:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/application.rb:165:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `public_send'
/usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `method_missing'
/usr/local/rvm/gems/ruby-2.3.4/gems/newrelic_rpm-3.14.1.311/lib/new_relic/agent/instrumentation/middleware_tracing.rb:79:in `call'
/usr/local/rvm/gems/ruby-2.3.4/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/local/rvm/gems/ruby-2.3.4/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
/usr/local/rvm/gems/ruby-2.3.4/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/local/rvm/gems/ruby-2.3.4/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/local/rvm/gems/ruby-2.3.4/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.3'

gem 'mysql2', '0.3.20'

gem 'sass-rails', '5.0.4'
gem 'coffee-rails', '4.1.1'
gem 'bootstrap-sass', '3.0.2.1'
gem "paperclip", "4.3.7"

gem 'therubyrhino', '2.0.4'
gem 'therubyracer', '0.12.2'
gem 'uglifier', '2.7.2'
gem 'rails-observers', '0.1.2'
gem 'actionpack-page_caching', '1.0.2'
gem 'actionpack-action_caching', '1.1.1'

gem 'omniauth', '1.4.1'
gem 'omniauth-oauth2', '1.4.0'

gem 'jquery-rails', '3.1.4'
gem 'devise', '3.5.4'
gem 'simple_form', '3.2.1'
gem 'jquery-datatables-rails', '2.2.3'
gem 'faraday', '0.8.11'
gem 'instagram', '0.10.0'
gem 'rack-cache', '1.5.1', :require => 'rack/cache'
gem "dragonfly", '0.9.15'
gem 'daemons', '1.2.3'
gem 'lazyload-rails', '0.2.0'
gem "spreadsheet", '1.1.1'
gem 'newrelic_rpm', '3.14.1.311'
gem "koala","2.2.0"
gem 'd3js-rails', '3.1.6'
gem 'twitter', '5.5.1'
gem 'will_paginate', '3.1.0'
gem 'gemoji', '2.1.0'
gem 'highcharts-rails', '4.1.9'
gem 'easy_translate', '0.5.0'
gem 'sidekiq', '4.1.2'
gem 'rufus-scheduler', '3.2.1'
gem "sidekiq-cron", "0.4.3"
gem 'sinatra', '1.4.6', :require => nil
gem 'mongoid', '5.1.4'
gem 'haml', '4.0.7'

group :development, :test do
  gem 'hirb'
  gem 'pry'
  gem 'pry-byebug'
  gem 'awesome_print', '~> 1.6.1'
  gem 'prawn'
  gem 'pdfkit'
  gem 'wkhtmltopdf-binary'
  gem 'capistrano', '~> 3.4.0'
  gem 'capistrano-rails', '~> 1.1.1'
  gem 'capistrano-bundler', '~> 1.1.2'
  gem 'capistrano-rvm'
  gem 'capistrano-passenger', github: 'capistrano/passenger'
  gem 'capistrano3-delayed-job', '~> 1.0'
  gem 'capistrano-sidekiq', github: 'seuros/capistrano-sidekiq'
end

Gemfile.lock:

GIT
  remote: git://github.com/capistrano/passenger.git
  revision: 223bf12f06c79febabba61ef24eb3752ee8e8f5c
  specs:
    capistrano-passenger (0.2.0)
      capistrano (~> 3.0)

GIT
  remote: git://github.com/seuros/capistrano-sidekiq.git
  revision: 339c42e24f42d8d72173daae832b23504930f941
  specs:
    capistrano-sidekiq (0.10.0)
      capistrano
      sidekiq (>= 3.4)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.3)
      actionview (= 4.2.3)
      activesupport (= 4.2.3)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionpack-action_caching (1.1.1)
      actionpack (>= 4.0.0, < 5.0)
    actionpack-page_caching (1.0.2)
      actionpack (>= 4.0.0, < 5)
    actionview (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.3)
      activesupport (= 4.2.3)
      globalid (>= 0.3.0)
    activemodel (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
    activerecord (4.2.3)
      activemodel (= 4.2.3)
      activesupport (= 4.2.3)
      arel (~> 6.0)
    activesupport (4.2.3)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.1)
      public_suffix (~> 2.0, >= 2.0.2)
    arel (6.0.4)
    awesome_print (1.6.1)
    bcrypt (3.1.11)
    bootstrap-sass (3.0.2.1)
      sass (~> 3.2)
    bson (4.2.1)
    buftok (0.2.0)
    builder (3.2.3)
    byebug (9.0.6)
    capistrano (3.4.1)
      i18n
      rake (>= 10.0.0)
      sshkit (~> 1.3)
    capistrano-bundler (1.1.4)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-rails (1.1.8)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    capistrano-rvm (0.1.2)
      capistrano (~> 3.0)
      sshkit (~> 1.2)
    capistrano3-delayed-job (1.7.2)
      capistrano (~> 3.0, >= 3.0.0)
    climate_control (0.1.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    coderay (1.1.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    connection_pool (2.2.1)
    d3js-rails (3.1.6)
      railties (>= 3.0, < 5.0)
    daemons (1.2.3)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    devise (3.5.4)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    dragonfly (0.9.15)
      multi_json (~> 1.0)
      rack
    easy_translate (0.5.0)
      json
      thread
      thread_safe
    equalizer (0.0.11)
    erubis (2.7.0)
    execjs (2.7.0)
    faraday (0.8.11)
      multipart-post (~> 1.2.0)
    faraday_middleware (0.11.0.1)
      faraday (>= 0.7.4, < 1.0)
    gemoji (2.1.0)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    haml (4.0.7)
      tilt
    hashie (3.5.5)
    highcharts-rails (4.1.9)
      railties (>= 3.1)
    hirb (0.7.3)
    http (0.5.1)
      http_parser.rb
    http_parser.rb (0.6.0)
    i18n (0.8.1)
    instagram (0.10.0)
      faraday (>= 0.7, < 0.9)
      faraday_middleware (~> 0.8)
      hashie (>= 0.4.0)
      multi_json (~> 1.0, >= 1.0.3)
    jquery-datatables-rails (2.2.3)
      jquery-rails
      sass-rails
    jquery-rails (3.1.4)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.6)
    jwt (1.5.6)
    koala (2.2.0)
      addressable
      faraday
      multi_json
    lazyload-rails (0.2.0)
      nokogiri (~> 1.5)
    libv8 (3.16.14.19)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.5)
      mime-types (>= 1.16, < 4)
    memoizable (0.4.2)
      thread_safe (~> 0.3, >= 0.3.1)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mimemagic (0.3.0)
    mini_portile2 (2.1.0)
    minitest (5.10.2)
    mongo (2.4.1)
      bson (>= 4.2.1, < 5.0.0)
    mongoid (5.1.4)
      activemodel (~> 4.0)
      mongo (~> 2.1)
      origin (~> 2.2)
      tzinfo (>= 0.3.37)
    multi_json (1.12.1)
    multi_xml (0.6.0)
    multipart-post (1.2.0)
    mysql2 (0.3.20)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (4.1.0)
    newrelic_rpm (3.14.1.311)
    nokogiri (1.7.2)
      mini_portile2 (~> 2.1.0)
    oauth2 (1.3.1)
      faraday (>= 0.8, < 0.12)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    omniauth (1.4.1)
      hashie (>= 1.2, < 4)
      rack (>= 1.0, < 3)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    origin (2.3.0)
    orm_adapter (0.5.0)
    paperclip (4.3.7)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (= 0.3.0)
    pdf-core (0.7.0)
    pdfkit (0.8.2)
    prawn (2.2.2)
      pdf-core (~> 0.7.0)
      ttfunk (~> 1.5)
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (3.4.2)
      byebug (~> 9.0)
      pry (~> 0.10)
    public_suffix (2.0.5)
    rack (1.6.6)
    rack-cache (1.5.1)
      rack (>= 0.4)
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.3)
      actionmailer (= 4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      activemodel (= 4.2.3)
      activerecord (= 4.2.3)
      activesupport (= 4.2.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.3)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.8)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-observers (0.1.2)
      activemodel (~> 4.0)
    railties (4.2.3)
      actionpack (= 4.2.3)
      activesupport (= 4.2.3)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    redis (3.3.3)
    redis-namespace (1.5.3)
      redis (~> 3.0, >= 3.0.4)
    ref (2.0.0)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    ruby-ole (1.2.12.1)
    rufus-scheduler (3.2.1)
    sass (3.4.23)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sidekiq (4.1.2)
      concurrent-ruby (~> 1.0)
      connection_pool (~> 2.2, >= 2.2.0)
      redis (~> 3.2, >= 3.2.1)
    sidekiq-cron (0.4.3)
      redis-namespace (>= 1.5.2)
      rufus-scheduler (>= 2.0.24)
      sidekiq (>= 4.0.0)
    simple_form (3.2.1)
      actionpack (> 4, < 5.1)
      activemodel (> 4, < 5.1)
    simple_oauth (0.2.0)
    sinatra (1.4.6)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    slop (3.6.0)
    spreadsheet (1.1.1)
      ruby-ole (>= 1.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sshkit (1.13.1)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    therubyracer (0.12.2)
      libv8 (~> 3.16.14.0)
      ref
    therubyrhino (2.0.4)
      therubyrhino_jar (>= 1.7.3)
    therubyrhino_jar (1.7.6)
    thor (0.19.4)
    thread (0.2.2)
    thread_safe (0.3.6)
    tilt (2.0.7)
    ttfunk (1.5.1)
    twitter (5.5.1)
      addressable (~> 2.3)
      buftok (~> 0.2.0)
      descendants_tracker (~> 0.0.3)
      equalizer (~> 0.0.9)
      faraday (>= 0.8, < 0.10)
      http (~> 0.5.0)
      http_parser.rb (~> 0.6.0)
      json (~> 1.8)
      memoizable (~> 0.4.0)
      simple_oauth (~> 0.2.0)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.7)
      rack (>= 1.0)
    will_paginate (3.1.0)
    wkhtmltopdf-binary (0.12.3.1)

PLATFORMS
  ruby

DEPENDENCIES
  actionpack-action_caching (= 1.1.1)
  actionpack-page_caching (= 1.0.2)
  awesome_print (~> 1.6.1)
  bootstrap-sass (= 3.0.2.1)
  capistrano (~> 3.4.0)
  capistrano-bundler (~> 1.1.2)
  capistrano-passenger!
  capistrano-rails (~> 1.1.1)
  capistrano-rvm
  capistrano-sidekiq!
  capistrano3-delayed-job (~> 1.0)
  coffee-rails (= 4.1.1)
  d3js-rails (= 3.1.6)
  daemons (= 1.2.3)
  devise (= 3.5.4)
  dragonfly (= 0.9.15)
  easy_translate (= 0.5.0)
  faraday (= 0.8.11)
  gemoji (= 2.1.0)
  haml (= 4.0.7)
  highcharts-rails (= 4.1.9)
  hirb
  instagram (= 0.10.0)
  jquery-datatables-rails (= 2.2.3)
  jquery-rails (= 3.1.4)
  koala (= 2.2.0)
  lazyload-rails (= 0.2.0)
  mongoid (= 5.1.4)
  mysql2 (= 0.3.20)
  newrelic_rpm (= 3.14.1.311)
  omniauth (= 1.4.1)
  omniauth-oauth2 (= 1.4.0)
  paperclip (= 4.3.7)
  pdfkit
  prawn
  pry
  pry-byebug
  rack-cache (= 1.5.1)
  rails (= 4.2.3)
  rails-observers (= 0.1.2)
  rufus-scheduler (= 3.2.1)
  sass-rails (= 5.0.4)
  sidekiq (= 4.1.2)
  sidekiq-cron (= 0.4.3)
  simple_form (= 3.2.1)
  sinatra (= 1.4.6)
  spreadsheet (= 1.1.1)
  therubyracer (= 0.12.2)
  therubyrhino (= 2.0.4)
  twitter (= 5.5.1)
  uglifier (= 2.7.2)
  will_paginate (= 3.1.0)
  wkhtmltopdf-binary

BUNDLED WITH
   1.14.6

Please let me know if anyone faced this kind of issue and able to resolve it.

Is there a way to reproduce this?

You said, you pasted the params for the query, I don't see them. Can you share more about the query itself.

@vipulnsward Thank you for responding.

I have updated the description and added the value of collector and dispatch[object.class] at the time of error. They are not exactly the parameters of visit method but they are the arguments of method call at line number 13 in which I am getting the error. The query is being fired using ActiveRecord as below:

For example: User.where(id: id, type: user_type)

Per #523, Arel development is moving to rails/rails.

If this issue is still relevant, please consider reopening it over there. (Note that the Rails repository does not accept feature request issues, and requires reproduction steps that rely on Active Record's documented API.)