Skip to content

editor crashing with infinite loops, and edge cases - update loop-protect to use jsbin/loop-protect #698

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

Open
1 of 3 tasks
Xendergo opened this issue Sep 20, 2018 · 9 comments
Assignees
Labels
Bug Error or unexpected behaviors Help Wanted Would love additional input or contributions! Priority:High Should be addressed soon but not critical
Milestone

Comments

@Xendergo
Copy link

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Details about the bug: When auto-refresh is enabled and I'm typing a for loop, the editor crashes.

  • Web browser and version: Google Chrome | 69.0.3497.92 (Official Build) (64-bit) (cohort: Stable)
  • Operating System: Windows 10
@catarak
Copy link
Member

catarak commented Sep 20, 2018

thanks for reporting! there's a library included in this project to prevent infinite loops from crashing the editor, which should prevent this. however, i noticed that

for (var i = 0; ;) {

}

is caught and stopped by the loop-protect code, but

for (let i = 0; ; ) {

}

is not caught and handled by the loop protect code.

@catarak catarak added type:bug Priority:Medium Moderately important, should be completed in a fair timeframe labels Sep 20, 2018
@catarak
Copy link
Member

catarak commented Sep 20, 2018

i was looking at the loop-protect library and it seems like the version that i made the fork from (jsbin/loop-protect) has updated the project a lot, and i think it would make sense for this project to switch from the fork i made to the jsbin library. i also just tested the two for loops on jsbin, and it seems to catch the infinite loop for both of them, so this gives me confidence that this change would fix this bug.

@catarak catarak changed the title Auto-refresh bug Auto-refresh bug - update loop-protect to use jsbin/loop-protect Sep 20, 2018
@catarak catarak added the Help Wanted Would love additional input or contributions! label Sep 20, 2018
@catarak
Copy link
Member

catarak commented Oct 3, 2018

i started to work on this, following the instructions here, but keep getting the following error from Babel: cannot read property 'registerPlugin' of undefined. for some reason when i do import Babel from '@babel/standalone';, Babel is still undefined.

@catarak catarak added Priority:High Should be addressed soon but not critical and removed Priority:Medium Moderately important, should be completed in a fair timeframe labels Oct 25, 2018
@catarak
Copy link
Member

catarak commented Oct 25, 2018

switching this to high priority—seems like it's causing a lot of bugs and frustration.

@catarak catarak changed the title Auto-refresh bug - update loop-protect to use jsbin/loop-protect editor crashing with infinite loops, and edge cases - update loop-protect to use jsbin/loop-protect Oct 25, 2018
@catarak catarak added this to the Post-Release milestone Oct 25, 2018
@siddhant1
Copy link
Contributor

@catarak can you help me with this.
I think we have to make changes in the previewEntry.js file?

@siddhant1
Copy link
Contributor

I have made some progress but not able to catch the infinite loop , I have asked the developer of this library to help me with it . I will send a PR soon to close this.

@siddhant1
Copy link
Contributor

I have made some progress and its running with var and while loops but for (let) loops are still not working

@siddhant1
Copy link
Contributor

Not sure if this is happening but I feel that we need to transpile down to es5 and then createa the transformed code , I converted it to use jsbin/loop-protect but it still stucks on for(let) loop #947

@goldwasser
Copy link

Though this thread is old, I wanted to upvote this significant problem in which an accidental infinite loop essentially leaves us doomed to have to close the window (and lose all saved work, though issue #1405 is separately addressing that).

What would be great is if there was a way for user to interrupt the script, even when stuck in an infinite loop. There is still a visible play/stop button in the editor GUI so it would be great if the thread that is running the sketch could have some intentionally yielding so the GUI has a chance to detect the stop button and stop the sketch thread from running. That would be ideal way to stop the loop while not having to close the window and lose code or crash the entire browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behaviors Help Wanted Would love additional input or contributions! Priority:High Should be addressed soon but not critical
Projects
None yet
Development

No branches or pull requests

5 participants