Khan / Khan/live-editor

Maximum stack size error not thrown from within special functions

Open
#749 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Original report from Larry Serflaten: https://support.khanacademy.org/hc/en-us/community/posts/360078034731-Bug-Report-Programming-environment-Maximum-stack-size-NOT-exceeded

A recursive runaway function that will normally error when entered directly, does not error when enclosed in an environment supplied ('special') function. Example code:

```
mouseClicked = function(){
var z = 0;
fill(0);

var stackKiller = function(){
background(255);
text(z++, 20, 20);
stackKiller(); // recursive error
};

// kaboom!
stackKiller();
};
```

Clicking on the mouse in that program should produce an error, but does not (currently).

If you move the above mouseClicked code to outside of the mouseClicked function, the expected 'maximum stack size exceeded' error will be reported. This seems to be true for all environment functions except the draw function which does report the error. MouseClicked, mousePressed, mouseDragged, keyPressed, were all tested and exhibited this same behavior.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the recursive example from the issue through mouseClicked, then compare its behavior with the same code outside the special function and with draw, which already reports the error. Check the mousePressed, mouseDragged, and keyPressed entry points as well; done means runaway recursion consistently reports the maximum stack size error in each affected environment function.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools
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.