Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

stack level too deep #23

Open
GabKlein opened this issue Dec 13, 2012 · 6 comments
Open

stack level too deep #23

GabKlein opened this issue Dec 13, 2012 · 6 comments

Comments

@GabKlein
Copy link

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'

@GabKlein
Copy link
Author

After couple of test its a problem with

gem "mongoid", :git => 'git://github.com/mongoid/mongoid.git', :branch => "4.0.0-dev"

@satb
Copy link

satb commented Feb 27, 2013

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:incall'
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:inreject!'
org/jruby/RubyArray.java:2558:in reject' (gem) actionpack-3.2.12/lib/action_view/template/resolver.rb:126:inquery'
(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:infind_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:infind_all'
(gem) actionpack-3.2.12/lib/action_view/path_set.rb:65:in find_all' org/jruby/RubyArray.java:1613:ineach'
(gem) actionpack-3.2.12/lib/action_view/path_set.rb:64:in find_all' org/jruby/RubyArray.java:1613:ineach'
(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:infind'
(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:insource'
(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:indigest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:ininstrument'
(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:indigest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:incollect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:independency_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:indigest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:ininstrument'
(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:indigest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:incollect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:independency_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:indigest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:ininstrument'
(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:indigest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:incollect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:independency_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:indigest'
(gem) activesupport-3.2.12/lib/active_support/cache.rb:297:in fetch' (gem) activesupport-3.2.12/lib/active_support/cache.rb:520:ininstrument'
(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:indigest'
(gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:85:in dependency_digest' org/jruby/RubyArray.java:2348:incollect'
org/jruby/RubyArray.java:2356:in collect' (gem) cache_digests-0.2.0/lib/cache_digests/template_digestor.rb:84:independency_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>

@speedmax
Copy link

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

@yuki24
Copy link

yuki24 commented Mar 30, 2013

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.

@satb
Copy link

satb commented Mar 30, 2013

I don't think we can close this issue because it happens even without Mongoid

@yuki24
Copy link

yuki24 commented Apr 1, 2013

@satb I think you are having a different issue. Create a new issue then try to solve again.

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

No branches or pull requests

4 participants