Skip to content
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

Max stack frames exceeded when using string interpolation in text blocks #134

Closed
guoshimin opened this issue Mar 21, 2016 · 1 comment
Closed
Labels

Comments

@guoshimin
Copy link
Contributor

To reproduce:

test.jsonnet

{
  text: |||
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pellentesque felis mi, et iaculis
    tellus consectetur pretium. Integer ultricies ullamcorper arcu quis bibendum. Vivamus luctus nec
    nulla id egestas. Vestibulum lectus nibh, lobortis sed gravida ac, pellentesque sit amet eros.
    Nulla urna purus, ornare at iaculis eget, pharetra sed libero. Fusce a neque malesuada,
    hendrerit ex nec, suscipit lorem. Aenean orci quam, placerat sed mollis ut, faucibus nec turpis.
    Vivamus consectetur auctor vehicula. Nam eu risus sit amet eros mattis finibus nec ac enim.
    Quisque velit metus, tristique in urna in, dictum gravida elit.%(a)s

    Aenean laoreet libero nunc. Cras molestie condimentum mollis. Nam quis leo sed enim vestibulum
    dapibus faucibus eget elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Class
    aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent
    cursus magna at urna viverra, eget venenatis ante sodales. In vitae magna sed lacus iaculis
    porttitor eu vel nisl. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae sapien
    vel eros ultricies iaculis. Pellentesque et metus libero. Proin nec rhoncus est. Vivamus a
    aliquam ipsum, ut vehicula nibh. Sed ac posuere dolor.
  ||| % {
    a: "a",
  }
}
$ jsonnet test.jsonnet
RUNTIME ERROR: Max stack frames exceeded.
    std.jsonnet:337:48-57   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    std.jsonnet:337:71-76   thunk <array_element>
    ...
    std.jsonnet:562:20-33   thunk <a>
    std.jsonnet:915:29  thunk <x>
    std.jsonnet:915:20-30   thunk <ta>
    std.jsonnet:917:33-34   thunk <a>
    std.jsonnet:917:13-39   function <anonymous>
    std.jsonnet:562:20-45   function <format_codes_obj>
    std.jsonnet:600:13-48   function <anonymous>
    std.jsonnet:132:13-28   function <anonymous>
    test.jsonnet:(2:9)-(20:3)   object <anonymous>
    During manifestation
sparkprime added a commit that referenced this issue Mar 21, 2016
Improve efficiency of std.format, side-effect fix #134
@sparkprime sparkprime added the bug label Mar 21, 2016
@sparkprime
Copy link
Contributor

Just adding some notes here:

This code was overly complicated so I simplified it, and this avoided the problem. But the underlying problem still remains, and code that is legitimately complex may trigger it in future.

The problem is we force thunk e in the case of f(e) tailstrict, but if e is an array or a std.makeArray or similar, then its elements are not currently forced.

One solution is to have a std.makeArrayStrict call that will make an array and force the thunks.

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

No branches or pull requests

2 participants