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
infinite loop false positives #174
Comments
The threshold is currently set to |
This has been increased to |
I've tested this and I'm not getting false positives anymore with nested pixel loops of typical sizes. I can still make it trigger if I am trying to iterate over a very high resolution image, but this is an edge case since it doesn't run at a reasonable speed anyway. So closing for now, we can always revisit. |
I am teaching a class on repetition this week, and the Given that this is to prevent the users browser from triggering an endless loop and that it won't bog down your server, why isn't this set much, much higher? |
@runemadsen no reason in particular! the default for the i think the downside of raising it is that it would be a longer delay for triggering the loop protection for cases when it is helpful. i can imagine scenarios in which this would be annoying, so i think it will take some experimentation to figure out what a good amount of time is. since the |
I notice that if I have a loop that executes for longer than the 500ms threshold I get the expected Exiting potential infinite loop exception unless I alter the code and remove a semicolon at the end of a line. The altered code will run to completion even though the elapsed time is greater than 500ms. Here is a simple example that demonstrates the behavior: https://editor.p5js.org/charlie-openschool/sketches/kGLK95CWa Is this expected? I would like to better understand this behavior. |
@charlie-openschool that is weird behavior! the |
I wanted to chime in that this is still an issue. I'm updating some of my online Processing resources to P5 so kids at home with school-supplied Chromebooks can use them, and found that P5 throws an infinite loop error for pretty much any nested loop. It's not just hitting for intense cases like pixel iteration Daniel mentioned, but even the most rudimentary nested loops, like this test case:
|
We had similar problems yesterday with the |
thanks for the updates! i know this is super annoying, and i'm going to shift updating the loop protect library up in priority (see #698). |
I'm going through and closing old issues/deduplicating them! Going to merge this into #698, the heart of this issue is that the library needs to be updated. |
I'm noticing this week in office hours (especially as students have nested loops iterating over pixels) that almost everyone has
//noprotect
in their code. It looks like maybe we need to extend the infinite loop detection to a little bit longer of a threshold?The text was updated successfully, but these errors were encountered: