SamSaffron/MiniProfiler

Fragment cache can't modify frozen object error rails 3

Opened this issue · 12 comments

Hi, I faced some issues with fragment caching while using that gem. Please look at the link http://stackoverflow.com/questions/14347602/fragment-cache-cant-modify-frozen-object-error-rails-3/14377501#14377501 for more details.

Please address the issue, is it some bug in your gem or some other issue in AR.

I experienced the exact same issue and removing this gem fixed it for me.

I think I just pulled a PR that fixes this, can you try grabbing latest from github to confirm its fixed?

Still broken for me. Re-added the gem yesterday, and immediately started getting the same error:
"NoMethodError: undefined method `result' for #<RuntimeError: can't modify frozen object>"

[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1147:in `translate_exception'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:284:in `rescue in log'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:90:in `insert'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/relation.rb:66:in `insert'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/persistence.rb:367:in `create'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/timestamp.rb:58:in `create'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/callbacks.rb:268:in `block in create'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:403:in `_run__2623713900290707479__create__4318799009460945156__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/callbacks.rb:268:in `create'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/persistence.rb:348:in `create_or_update'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/callbacks.rb:264:in `block in create_or_update'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:480:in `_run__2623713900290707479__save__4318799009460945156__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/callbacks.rb:264:in `create_or_update'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/persistence.rb:84:in `save'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/validations.rb:50:in `save'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/attribute_methods/dirty.rb:22:in `save'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block in save'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
[GEM_ROOT]/gems/activerecord-3.2.13/lib/active_record/transactions.rb:258:in `save'

Me too! The lasted branch still broke!

I'm also running into this issue. I'm trying with master and I'm getting this:

RuntimeError: can't modify frozen object: ROLLBACK

ActiveRecord::StatementInvalid (RuntimeError: can't modify frozen object: UPDATE `users` SET `last_request_at` = '2013-07-04 18:40:00', `perishable_token` = 'qenY3ShlD5ofURVg3oD', `updated_at` = '2013-07-04 18:40:00' WHERE `users`.`id` = 8):
  app/controllers/application_controller.rb:80:in `current_user_session'
  app/controllers/application_controller.rb:66:in `current_user'
  app/helpers/liquid/application_helper.rb:114:in `wrapped_product'
  app/helpers/liquid/application_helper.rb:121:in `block in wrapped_products'
  app/helpers/liquid/application_helper.rb:121:in `map'
  app/helpers/liquid/application_helper.rb:121:in `wrapped_products'
  app/controllers/products_controller.rb:117:in `products_index'
  app/controllers/products_controller.rb:34:in `index'

Any ideas? Thanks!

getting the same exact error as @etagwerker
rack-mini-profiler (0.1.31)

z5h commented

Same error rack-mini-profiler (0.1.31)

Same error rack-mini-profiler (0.9.0)

I get this error as well. This happens to me in my custom Devise::OmniauthCallbacksController. Removing rack-mini-profiler immediately fixes this problem.

+1 for this error on edge rails (4.1.0.rc1)

Yep, still a problem.

Seems like it's fixed in 0.9.1.