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

Ace of Coders - Maximum call stack size exceeded #3049

Closed
MHeasell opened this Issue Sep 23, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@MHeasell

MHeasell commented Sep 23, 2015

After messing around with Ace of Coders for a while I've hit the following issue a bunch of times. On compiling certain code, my hero stands motionless but the UI doesn't indicate any code errors, and no Ice Yaks spawn. I get the following message in the JavaScript console:

ERROR in transforms.getUserFnMap RangeError: Maximum call stack size exceeded
    at Array.toString (native)
    at h (http://codecombat.com/javascripts/aether.js:2578:15)
    at h (http://codecombat.com/javascripts/aether.js:2580:27)
    at s (http://codecombat.com/javascripts/aether.js:2574:70)
    at s (http://codecombat.com/javascripts/aether.js:2575:103)
    at h (http://codecombat.com/javascripts/aether.js:2579:294)
    at s (http://codecombat.com/javascripts/aether.js:2574:70)
    at s (http://codecombat.com/javascripts/aether.js:2575:103)
    at h (http://codecombat.com/javascripts/aether.js:2579:294)
    at s (http://codecombat.com/javascripts/aether.js:2574:70)

I don't have a minimal example for this, but it seems to happen reliably with certain versions of my code. I'm guessing it's a transpiler bug rather than a problem with my code, but I'm sure I could be proven wrong. I could share my code privately with a dev if this is helpful.

@nwinter

This comment has been minimized.

Contributor

nwinter commented Sep 23, 2015

Hey @MHeasell, sorry about that! Sounds like this bug with this code. Can you find a minimal subset of your code that is triggering it? (It's probably just one or two function signatures.)

Will be excited when we fix this one!

@nwinter nwinter added the bug label Sep 23, 2015

@MHeasell

This comment has been minimized.

MHeasell commented Sep 23, 2015

Okay, @nwinter, here is the smallest complete example I could come up with. When pasted into the editor for Ace of Coders, I get the mentioned error in the console.

var v = new Vector(0, 0);

this.foo = function (units) {
    for (var i = 0; i < units.length; ++i) {
        var unit = units[i];
        var d = unit.pos.distance(v);
    }
};

this.bar = function (units) {
    for (var i = 0; i < units.length; ++i) {
        var unit = units[i];
        var d = unit.pos.distance(v);
    }
};

Some observations:

  • Deleting either function makes the error go away
  • Replacing either occurrence of units[i] with units[0] makes the error go away

Happy debugging!

@nwinter

This comment has been minimized.

Contributor

nwinter commented Sep 23, 2015

Thanks! Can you find a workaround (perhaps by changing argument/function names) that lets you get past it for now in your real code?

@MHeasell

This comment has been minimized.

MHeasell commented Sep 23, 2015

Hmm, I see now that renaming the units parameter in one of the functions to something else is also enough to avoid triggering the error.

I can probably work with this, assuming that this solves the problem in my competitive code. Isolating this bug has stolen all my motivation for the short-term though, so I'll have to wait for another time to see how things go.

@Driphter

This comment has been minimized.

Contributor

Driphter commented Sep 23, 2015

I've also been encountering this bug. I've been working around it by, like you, fiddling with the problematic functions. Usually it's changing unitA.distanceTo(unitB) to unitA.pos.distance(unitB.pos).

@transitive-bullshit

This comment has been minimized.

transitive-bullshit commented Sep 30, 2015

👍

@nwinter

This comment has been minimized.

Contributor

nwinter commented May 22, 2016

Should be fixed with @basicer's new Esper interpreter.

@nwinter nwinter closed this May 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment