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

Maximum call stack size exceeded when comparing long strings #49

Closed
nonpop opened this issue Nov 10, 2018 · 7 comments · Fixed by rtfeldman/node-test-runner#319
Closed

Comments

@nonpop
Copy link

nonpop commented Nov 10, 2018

This might be the same problem as #22 or rtfeldman/node-test-runner#290 but here with very simple data which seems to point to a problem with output string diffing.

So, the following:

sscce : Test
sscce =
    test "Different long strings" <|
        \_ ->
            String.repeat 1000 "a"
                |> Expect.equal (String.repeat 1000 "b")

causes

Tests.elm changed. Rebuilding!

elm-test 0.19.0-beta12
----------------------

Running 1 test. To reproduce these results, run: elm-test --fuzz 100 --seed 354267269012927 /home/nonpop/projects/elm/sscce/tests/Tests.elm

/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:579
function _Utils_eqHelp(x, y, depth, stack)
                      ^

RangeError: Maximum call stack size exceeded
    at _Utils_eqHelp (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:579:23)
    at _Utils_eq (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:570:35)
    at /home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:3452:9
    at Function.f (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:3493:5)
    at A5 (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:113:28)
    at /home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:3497:13
    at Function.f (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:3434:11)
    at A2 (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:104:28)
    at Function.f (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:3494:11)
    at A5 (/home/nonpop/projects/elm/sscce/elm-stuff/generated-code/elm-explorations/test/elmTestOutput.js:113:28)

Everything works if I make the strings the same by just changing "b" to "a".

@mgold
Copy link
Collaborator

mgold commented Nov 11, 2018

The stack trace would indeed indicate output, which is weird because I would have suspected shrinking.

@drathier
Copy link
Collaborator

Are these stack overflows fixed by the optimiser in 0.19?

@nonpop
Copy link
Author

nonpop commented Nov 12, 2018

The stack trace would indeed indicate output, which is weird because I would have suspected shrinking.

I know nothing about the internals of of elm-test, but it sounds weird that shrinking would even happen when there are no fuzzers involved?

Are these stack overflows fixed by the optimiser in 0.19?

How to test that?

@drathier
Copy link
Collaborator

If you have a test that always gives a stack overflow in 0.18, you could update it to 0.19 and see if it still stack overflows.

@nonpop
Copy link
Author

nonpop commented Nov 12, 2018

I don't remember ever getting a stack overflow in 0.18. This example also works just fine with Elm 0.18 and elm-test 0.18.13-beta3, even if I make the strings longer (then it just takes forever).

@drathier
Copy link
Collaborator

My bad, thought this was the 0.18 repo. Carry on.

@nonpop
Copy link
Author

nonpop commented Nov 14, 2018

With a longer stack trace it looks like the problem arises from Test.Runner.Node.Vendor.Diff.makeChangesHelp calling itself recursively through andThen. In 0.18 makeChangesHelp is tail recursive. Maybe I should file the issue in the node-test-runner repo instead?

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

Successfully merging a pull request may close this issue.

3 participants