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
Add INFINITE_LOOP_TRAP
back to non-Maze app types
#22463
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle failure looks legit.
Does this play nicely with *labs levels that we expect to run for >5e5 ticks?
Play Lab goes through the |
Awesome! Have you verified the timeout against some of the longer artist drawings? And can we also remove the maze special case for this? |
It looks like codegen is wrong for Globals.f = function(x) {
return executionInfo.checkTimeout(); if (executionInfo.isTerminated()){return;}
( x + 1)
}
; return( ( 2 + 1) == Globals.f( 2)) |
@Hamms PTAL! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still worried about the impact this will have on the longer artist drawings, particularly the really cool fractal ones
Hmm — 500,000 steps is a lot. A program like that would noticeably hang most browsers. What cutoff do you think is best? |
Oh dang, right you are. Even https://studio.code.org/projects/artist/Ut6coOwiXo_fg_B6Eh2CAA/edit only takes ~50k steps. Worry sated! This LGTM |
Some interesting history here:
Blockly.JavaScript.INFINITE_LOOP_TRAP
was renamed toBlocklyApps.INFINITE_LOOP_TRAP
almost 5 years ago, accidentally breaking Blockly's built-in infinite loop detection.I picked half a million steps sort-of-arbitrarily. It takes about 5 seconds to catch the infinite loop. I tried to balance user experience (don't freeze the browser too long) against not cutting off programs early that draw complex things.
The thrown exception is caught here:
code-dot-org/apps/src/turtle/artist.js
Lines 693 to 696 in ba8124e