google / google/go-jsonnet

Regression in stack usage from 0.17 to 0.18

Open
#590 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

There seems to be a regression in the use of the stack from version 0.17 to version 0.18. I have been able to reproduce with a simple bit of jsonnet code. Notice how it works fine in version 0.17 with a max stack of 128, but causes max stack frames to be exceeded in version 0.18 unless I up the max stack to 2005

```
[C:\>]$ gojsonnet17.exe -v
Jsonnet commandline interpreter v0.17.0
12:19:43 [ppodaril@ppod-base C:\g\A\F\idsr]$ gojsonnet17.exe -e --max-stack 128 '{ \"a\": std.foldl(function(p, c) p{ \"test\"+: { \"t\": c }}, std.range(0, 2000), {}) }'
{
"a": {
"test": {
"t": 2000
}
}
}
[C:\>]$ gojsonnet18.exe -v
Jsonnet commandline interpreter (Go implementation) v0.18.0
[C:\>]$ gojsonnet18.exe -e --max-stack 128 '{ \"a\": std.foldl(function(p, c) p{ \"test\"+: { \"t\": c }}, std.range(0, 2000), {}) }'
RUNTIME ERROR: max stack frames exceeded.
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
...
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
:1:45-55 +:
Field "test"
Field "a"
During manifestation

[C:\>]$ gojsonnet18.exe -e --max-stack 2005 '{ \"a\": std.foldl(function(p, c) p{ \"test\"+: { \"t\": c }}, std.range(0, 2000), {}) }'
{
"a": {
"test": {
"t": 2000
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.