cache_digests
cache_digests copied to clipboard
stack level too deep
Hello,
This morning I tried to use cache_digests on my rails4 app. I tried with a simple code on my users#edit.html.haml view:
%div{:class=>"container-fluid", :id => 'profile'}
.well
.row-fluid
#avatar= render :partial => 'users/profile/avatar'
#personalities= render :partial => 'users/profile/personalities'
.row-fluid
#offers= render :partial => 'users/profile/offers'
#contacts= render :partial => 'users/profile/contacts'
#connections= render :partial => 'users/profile/connections'
.row-fluid
#images= render :partial => 'users/profile/images'
:javascript
simpleFormField();
simpleFormCheckbox();
- cache do
toto
And surprise I got this message:
Cache digest for users/profile/avatar.html: 601b4fba0220b21478222b7ec53b4ec0 Cache digest for users/profile/personalities.html: c89e0f02eaeb2359fc9ef2d377bd8baf Cache digest for users/profile/offers.html: 6a2f845587bc00b24f3c80ce5ca338bc Cache digest for users/profile/contacts.html: cc807b021cc3b52206bae3f77eaea5a9 Cache digest for users/profile/omniauth.html: 710eaf3242bbc3901951774618605f43 Cache digest for users/profile/connections.html: 35aa840682ad2157cb52d0412d43b470 Cache digest for users/profile/images.html: 9b6a871b191588c98ebddfdd08c06a75 Cache digest for users/edit.html: 63cf22204875976adc0847c7cd2c312c Rendered users/edit.html.haml within layouts/application (263.5ms) Completed 500 Internal Server Error in 759ms
ActionView::Template::Error (stack level too deep): /Users/uto/.rvm/gems/ruby-1.9.3-p327/bundler/gems/rails-5d54fd77b8e8/activesupport/lib/active_support/cache.rb:0
Rendered /Users/uto/.rvm/gems/ruby-1.9.3-p327/bundler/gems/rails-5d54fd77b8e8/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms) Rendered /Users/uto/.rvm/gems/ruby-1.9.3-p327/bundler/gems/rails-5d54fd77b8e8/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms) Rendered /Users/uto/.rvm/gems/ruby-1.9.3-p327/bundler/gems/rails-5d54fd77b8e8/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (16.8ms)
My Gemfile:
source 'https://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git' gem "journey", :git => "git://github.com/rails/journey" gem 'activerecord-deprecated_finders', :git => 'git://github.com/rails/activerecord-deprecated_finders.git' gem 'turbolinks', "= 0.5.1" gem 'haml-rails', :git => 'git://github.com/indirect/haml-rails.git' gem 'sprockets-rails', :git => 'git://github.com/rails/sprockets-rails.git'
group :assets do gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git' gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git' gem 'less-rails' gem 'twitter-bootstrap-rails' gem 'less-rails-fontawesome', :git => 'git://github.com/GabKlein/less-rails-fontawesome.git' gem 'therubyracer' gem 'uglifier' end
gem 'jquery-rails' gem 'jquery-cookie-rails' gem 'jquery-turbolinks'
gem 'ohm' gem 'ohm-contrib' gem 'mysql2' gem "mongoid", :git => 'git://github.com/mongoid/mongoid.git', :branch => "4.0.0-dev" gem 'tire', :git => 'git://github.com/GabKlein/tire.git' gem 'tire-contrib'
gem 'dalli' gem 'cache_digests'
gem 'redis' gem 'redis-store', :git => 'git://github.com/jodosha/redis-store.git' gem 'redis-objects', :require => 'redis/objects'
gem 'authlogic' gem 'omniauth-google-oauth2', :git => 'git://github.com/zquestz/omniauth-google-oauth2.git' gem 'omniauth-facebook', :git => 'git://github.com/mkdynamic/omniauth-facebook.git' gem 'fb_graph'
gem 'will_paginate', '~> 3.0' gem 'uuidtools' gem 'tlsmail' gem 'geocoder' gem 'rmagick' gem 'carrierwave', :git => 'git://github.com/jnicklas/carrierwave.git' gem 'activerecord-reputation-system', :git => 'git://github.com/GabKlein/activerecord-reputation-system.git' gem 'unicorn'
After couple of test its a problem with
gem "mongoid", :git => 'git://github.com/mongoid/mongoid.git', :branch => "4.0.0-dev"
I am getting the same error as well. Using JRuby 1.7.2 and rails 3.2.12. I am using the "closure_tree" gem that has some sort of recursion. Don't know if that is causing this.
SystemStackError - stack level too deep:
org/jruby/RubyProc.java:261:in call' org/jruby/RubyProc.java:249:in
call'
org/jruby/RubyHash.java:681:in default' org/jruby/RubyHash.java:1070:in
[]'
(gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:127:in query' org/jruby/RubyArray.java:2595:in
reject!'
org/jruby/RubyArray.java:2558:in reject' (gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:126:in
query'
(gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:117:in find_templates' (gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:46:in
find_all'
(gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:77:in cached' (gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:45:in
find_all'
(gem) actionpack-3.2.12/lib/action_view/path_set.rb:65:in find_all' org/jruby/RubyArray.java:1613:in
each'
(gem) actionpack-3.2.12/lib/action_view/path_set.rb:64:in find_all' org/jruby/RubyArray.java:1613:in
each'
(gem) actionpack-3.2.12/lib/action_view/path_set.rb:63:in find_all' (gem) actionpack-3.2.12/lib/action_view/path_set.rb:58:in
find'
(gem) actionpack-3.2.12/lib/action_view/lookup_context.rb:109:in find' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:79:in
source'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:43:in digest' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:32:in
digest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:in
instrument'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:296:in fetch' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:31:in
digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:in
collect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:in
dependency_digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:43:in digest' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:32:in
digest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:in
instrument'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:296:in fetch' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:31:in
digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:in
collect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:in
dependency_digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:43:in digest' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:32:in
digest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:in
instrument'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:296:in fetch' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:31:in
digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:in
collect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:in
dependency_digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:43:in digest' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:32:in
digest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:in
instrument'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:296:in fetch' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:31:in
digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:in
collect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:in
dependency_digest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:43:in `digest'
Not having issues if I remove "cache_digests". It works without causing the "stack too deep" problem with just fragment caching
application.html.erb has:
<% root_children = Category.root.children %>
<% cache "menu" do %>
<ul class="nav">
<% root_children.each do |c| %>
<%= render partial: "categories/menu", locals: {category: c} %>
<% end %>
</ul>
<% end %>
category/_menu.html.erb
<% if not (category.leaf?) %>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"><%= category.name %><span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<%= link_to "All #{pluralize("", category.name)}'", items_path(category_id: category) %>
</li>
<% category.children.each do |c| %>
<%= render partial: "categories/menu", locals: {category: c} %>
<% end %>
</ul>
</li>
<% else %>
<%= render partial: "categories/menu_item", locals: {category: category} %>
<% end %>
category/_menu_item.html.erb
<li>
<%= link_to "#{category.name}", items_path(category_id: category) %>
</li>
I run into the same problem using rails4 and github: 'mongoid/mongoid'
index.html
<%= render @items %>
items/_item.html.erb
<% cache item do %>
hello
<% end %>
even string cache key breaks
<% cache "hello" do %>
hello
<% end %>
Completed 500 Internal Server Error in 198ms
ActionView::Template::Error (stack level too deep): activesupport (4.0.0.beta1) lib/active_support/cache.rb:93
I described more about this issue on https://github.com/mongoid/mongoid/issues/2903#issuecomment-15672128.
I also don't think this is an issue of cache_digests
, so we can close this issue now.
I don't think we can close this issue because it happens even without Mongoid
@satb I think you are having a different issue. Create a new issue then try to solve again.