Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant ActiveRecord::AttributeSet #34853

Closed
fadyZohdy opened this issue Jan 3, 2019 · 6 comments
Closed

uninitialized constant ActiveRecord::AttributeSet #34853

fadyZohdy opened this issue Jan 3, 2019 · 6 comments

Comments

@fadyZohdy
Copy link

we are trying to upgrade to rails 5.2.2 but are currently hitting this issue

org/jruby/RubyModule.java:3532→ const_missing
org/jruby/RubyModule.java:3479→ const_get
activesupport-5.2.2/lib/active_support/inflector/methods.rb:285→ block in constantize
org/jruby/RubyArray.java:1789→ each
org/jruby/RubyEnumerable.java:1047→ inject
activesupport-5.2.2/lib/active_support/inflector/methods.rb:281→ constantize
activesupport-5.2.2/lib/active_support/core_ext/string/inflections.rb:68→ constantize
activesupport-5.2.2/lib/active_support/core_ext/marshal.rb:10→ load
redis-store-1.6.0/lib/redis/store/serialization.rb:44→ _unmarshal
redis-store-1.6.0/lib/redis/store/serialization.rb:17→ get
redis-store-1.6.0/lib/redis/store/namespace.rb:23→ block in get
redis-store-1.6.0/lib/redis/store/namespace.rb:89→ namespace
redis-store-1.6.0/lib/redis/store/namespace.rb:23→ get
redis-activesupport-5.0.7/lib/active_support/cache/redis_store.rb:266→ block in read_entry
connection_pool-2.2.2/lib/connection_pool.rb:65→ block in with
org/jruby/RubyThread.java:750→ handle_interrupt
connection_pool-2.2.2/lib/connection_pool.rb:64→ block in with
org/jruby/RubyThread.java:750→ handle_interrupt
connection_pool-2.2.2/lib/connection_pool.rb:61→ with
redis-activesupport-5.0.7/lib/active_support/cache/redis_store.rb:246→ with
redis-activesupport-5.0.7/lib/active_support/cache/redis_store.rb:266→ read_entry
activesupport-5.2.2/lib/active_support/cache.rb:313→ block in fetch
activesupport-5.2.2/lib/active_support/cache.rb:663→ block in instrument
activesupport-5.2.2/lib/active_support/notifications.rb:170→ instrument
activesupport-5.2.2/lib/active_support/cache.rb:663→ instrument
activesupport-5.2.2/lib/active_support/cache.rb:312→ fetch
app/lib/back_office.rb:515→ next_delivery_of_user
app/controllers/application_controller.rb:65→ user_config
actionpack-5.2.2/lib/action_controller/metal/basic_implicit_render.rb:6→ send_action
actionpack-5.2.2/lib/abstract_controller/base.rb:194→ process_action
actionpack-5.2.2/lib/action_controller/metal/rendering.rb:30→ process_action
actionpack-5.2.2/lib/abstract_controller/callbacks.rb:42→ block in process_action
activesupport-5.2.2/lib/active_support/callbacks.rb:109→ block in run_callbacks
sentry-raven-2.7.4/lib/raven/integrations/rails/controller_transaction.rb:7→ block in included
org/jruby/RubyBasicObject.java:2666→ instance_exec
activesupport-5.2.2/lib/active_support/callbacks.rb:118→ block in run_callbacks
activesupport-5.2.2/lib/active_support/callbacks.rb:136→ run_callbacks
actionpack-5.2.2/lib/abstract_controller/callbacks.rb:41→ process_action
actionpack-5.2.2/lib/action_controller/metal/rescue.rb:22→ process_action
actionpack-5.2.2/lib/action_controller/metal/instrumentation.rb:34→ block in process_action
activesupport-5.2.2/lib/active_support/notifications.rb:168→ block in instrument
activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb:23→ instrument
activesupport-5.2.2/lib/active_support/notifications.rb:168→ instrument
actionpack-5.2.2/lib/action_controller/metal/instrumentation.rb:32→ process_action
actionpack-5.2.2/lib/action_controller/metal/params_wrapper.rb:256→ process_action
activerecord-5.2.2/lib/active_record/railties/controller_runtime.rb:24→ process_action
actionpack-5.2.2/lib/abstract_controller/base.rb:134→ process
actionview-5.2.2/lib/action_view/rendering.rb:32→ process
actionpack-5.2.2/lib/action_controller/metal.rb:191→ dispatch
actionpack-5.2.2/lib/action_controller/metal.rb:252→ dispatch
actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:52→ dispatch
actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:34→ serve
actionpack-5.2.2/lib/action_dispatch/journey/router.rb:52→ block in serve
org/jruby/RubyArray.java:1789→ each
actionpack-5.2.2/lib/action_dispatch/journey/router.rb:35→ serve
actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:840→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
aws-xray-sdk-0.11.1/lib/aws-xray-sdk/facets/rails/ex_middleware.rb:16→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
newrelic_rpm-5.0.0.342/lib/new_relic/rack/agent_hooks.rb:30→ traced_call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
newrelic_rpm-5.0.0.342/lib/new_relic/rack/browser_monitoring.rb:32→ traced_call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
app/middleware/custom_rescueable.rb:14→ _call
app/middleware/custom_rescueable.rb:8→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
prometheus-client-0.8.0/lib/prometheus/middleware/exporter.rb:32→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
prometheus-client-0.8.0/lib/prometheus/middleware/collector.rb:38→ block in call
prometheus-client-0.8.0/lib/prometheus/middleware/collector.rb:84→ block in trace
/opt/jruby/lib/ruby/stdlib/benchmark.rb:308→ realtime
prometheus-client-0.8.0/lib/prometheus/middleware/collector.rb:84→ trace
prometheus-client-0.8.0/lib/prometheus/middleware/collector.rb:38→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
warden-1.2.8/lib/warden/manager.rb:36→ block in call
org/jruby/RubyKernel.java:1181→ catch
warden-1.2.8/lib/warden/manager.rb:34→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-2.0.6/lib/rack/etag.rb:25→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-2.0.6/lib/rack/conditional_get.rb:25→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-2.0.6/lib/rack/head.rb:12→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:28→ block in call
activesupport-5.2.2/lib/active_support/callbacks.rb:98→ run_callbacks
actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:26→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
airbrake-5.8.1/lib/airbrake/rack/middleware.rb:52→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:61→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
railties-5.2.2/lib/rails/rack/logger.rb:38→ call_app
railties-5.2.2/lib/rails/rack/logger.rb:26→ block in call
activesupport-5.2.2/lib/active_support/tagged_logging.rb:71→ block in tagged
activesupport-5.2.2/lib/active_support/tagged_logging.rb:28→ tagged
activesupport-5.2.2/lib/active_support/tagged_logging.rb:71→ tagged
railties-5.2.2/lib/rails/rack/logger.rb:26→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-timeout-0.5.1/lib/rack/timeout/core.rb:123→ block in call
rack-timeout-0.5.1/lib/rack/timeout/support/timeout.rb:19→ timeout
rack-timeout-0.5.1/lib/rack/timeout/core.rb:122→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
request_store-1.4.1/lib/request_store/middleware.rb:19→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-2.0.6/lib/rack/runtime.rb:22→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-timeout-0.5.1/lib/rack/timeout/core.rb:123→ block in call
rack-timeout-0.5.1/lib/rack/timeout/support/timeout.rb:19→ timeout
rack-timeout-0.5.1/lib/rack/timeout/core.rb:122→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-cache-1.8.0/lib/rack/cache/context.rb:140→ forward
rack-cache-1.8.0/lib/rack/cache/context.rb:249→ fetch
rack-cache-1.8.0/lib/rack/cache/context.rb:189→ lookup
rack-cache-1.8.0/lib/rack/cache/context.rb:66→ call!
rack-cache-1.8.0/lib/rack/cache/context.rb:51→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-2.0.6/lib/rack/sendfile.rb:111→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
app/middleware/track_bad_response_code_to_mixpanel.rb:12→ _call
app/middleware/track_bad_response_code_to_mixpanel.rb:7→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
app/middleware/log_item_view.rb:31→ _call
app/middleware/log_item_view.rb:7→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
app/middleware/log_request.rb:23→ _call
app/middleware/log_request.rb:7→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
sentry-raven-2.7.4/lib/raven/integrations/rack.rb:51→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
aws-xray-sdk-0.11.1/lib/aws-xray-sdk/facets/rack.rb:43→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
rack-cors-1.0.2/lib/rack/cors.rb:97→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
railties-5.2.2/lib/rails/engine.rb:524→ call
newrelic_rpm-5.0.0.342/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92→ call
puma-3.12.0-java/lib/puma/configuration.rb:225→ call
puma-3.12.0-java/lib/puma/server.rb:658→ handle_request
puma-3.12.0-java/lib/puma/server.rb:472→ process_client
puma-3.12.0-java/lib/puma/server.rb:332→ block in run
puma-3.12.0-java/lib/puma/thread_pool.rb:133→ block in spawn_thread

ruby_version: jruby 9.2.4.0 (2.5.0)
rails : 5.2.2
redis (4.1.0)
redis-actionpack (5.0.2)
redis-activesupport (5.0.7)
redis-rack (2.0.5)
redis-rack-cache (2.0.2)
redis-rails (5.0.2)
redis-session-store (0.11.0)
redis-store (1.6.0)

this is the line of code where the issue originates from

Rails.cache.fetch("box/#{user.cache_key}/#{options.keys.join(",")}") do
    ...
end
@rafaelfranca
Copy link
Member

This constant doesn't exist anymore in Rails 5.2. It is not safe to share the same cache between two versions of Rails. You should either flush the cache during deploy or add compatibility code in your application to handle the difference between version.

@bipashant
Copy link
Contributor

Rails.cache.clear Helped me!

@OxSon
Copy link

OxSon commented Apr 30, 2020

Rails.cache.clear helped me as well. If anyone here is getting a related error of the form TypeError ... singleton can't be dumped check out this issue.

@dhurba87
Copy link

dhurba87 commented Sep 1, 2020

Rails.cache.clear Helped me!

or this rake tmp:clear from a rake task

@dbackeus
Copy link

Note regarding Rails 6.1: We did a temporary deploy of 6.1 to our production environment to scan for errors. When reverting back to 6.0 we started hitting uninitialized constant ActiveModel::LazyAttributeSet on hitting the cache.

Redeploying 6.1 fixed our issues but running Rails.cache.clear would probably have been a quicker and less stressful fix (accounting for our deploy times being 15 minutes long). Wiping our 10GB production cache would have been unknown territory for us though so it's unclear how much eg. timeout errors it would have ended up causing.

@khun84
Copy link

khun84 commented Jan 19, 2022

This constant doesn't exist anymore in Rails 5.2. It is not safe to share the same cache between two versions of Rails. You should either flush the cache during deploy or add compatibility code in your application to handle the difference between version.

Thats what I did when upgrading from Rails 5.0 to Rails 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants