Shopify / Shopify/liquid

Rendering continues after Liquid::StackLevelError which can result in a lot of similar errors with recursion

Open
#1,435 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

In Shopify, create a page template page.test2.liquid

{% layout none %}
{% assign aacounter = 1 %}
{% include 'aaaaa' %}

Create a snippet aaaaa.liquid

{{ aacounter }} {% assign aacounter = aacounter | plus: 1 %}
({% include 'aaaaa' %})
{% if aacounter < 10000 %}
[{% include 'aaaaa' %}]
{% endif %}
a 

Create a page and set it to the template. Launch the page.

Interestingly, because the snippet was included twice, it bypasses the MAX_DEPTH of 100 and continues the recursion forever. Eventually, Shopify server times out and kills the thread, then gives an error page. In the above example, 10000 would still work and give an output.

image

But if you set it to 15000 (or remove the check altogether), it will give the error page below:

image

This happens for both include and render. Related issue: #970

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the page.test2.liquid template and recursive aaaaa.liquid snippet, testing both include and render. Start by tracing how a Liquid::StackLevelError is handled during rendering; done means rendering stops after the error instead of continuing recursion until a timeout or repeated errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.