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
self-referential templates blow up rake task but not server #18667
Comments
(i'm putting together a PoC rails app) |
Here is the repo: https://github.com/jjb/rails-18667 All the relevant files are in this commit: jjb/rails-18667@5b1fa9a To observe the infinite loop: rake cache_digests:nested_dependencies TEMPLATE=things/index To observe that nested dependency calculation is working and not blowing up when the server is running:
(n.b. if you change any of the files back to a previous state, rails will reuse the previously built cache. this might be confusing if you are toggling back and forth between states and expecting the number to keep increasing.) |
@jiripospisil a new bug, see above |
@jjb It seems like the protection against recursion is not used in the code path invoked by |
@jiripospisil which version of rails did you base your method on? it has a different signature than the one in 4.1.8 |
@jjb You mean the |
ahh, gotcha. |
@rafaelfranca @tvdeyen any thoughts on making the rake task's behavior more in line with in-app behavior? if we all agree this is not ideal I can work on a PR, just making sure I'm headed in the right direction first. |
This issue has been automatically marked as stale because it has not been commented on for at least The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the Thank you for all your contributions. |
I did reproduce it above: #18667 (comment) |
Thanks |
I have two partials which refer to one another. When I calculate nested dependencies in the console like so:
or via the rake task like so:
rake cache_digests:nested_dependencies TEMPLATE=posts/show
I get a short list of initial dependencies, and then this in an infinite loop, until the ruby stack is full (I have some debug code outputting which template is being loaded):
However, when I run the app server and request the template, things run just fine, no infinite loops.
Here are my settings in all of the above cases:
The code indicates that it does have recursive reference protection: https://github.com/rails/rails/blob/v4.1.8/actionview/lib/action_view/digestor.rb#L35
I'm not really groking that code. It seems like the recursive reference protection is working in the server environment but not in console or the rake task.
(also a SO question http://stackoverflow.com/questions/28018187)
The text was updated successfully, but these errors were encountered: