CodeSandBox Infinite loop issues permanently bricking programs

I’ve been working with CodeSandBox recently, and have noticed the complete lack of infinite loop protection.

Here is a example box: frosty-rain-km2wru - CodeSandbox

Its a Three.js program, so code is called every single frame. In this case, the program ran while I was still typing code in the render function, causing a error every single frame. Within a few seconds I would get 1000 errors, degrading performance.

I was able to fix this, after hard resetting my chrome multiple times (even closing out of the code sandbox tab still causes it to run). I had to reopen the box and try to comment out the animate code as quickly as possible before it would freeze within a second.

Now when I fire up the box, it works, but now it displays two accounts running on it at the same time and I am completely locked out of the editor. Refreshing the page does nothing, just constantly loads.

The codesandbox viewer on the right runs correctly, but the editor itself is completely frozen. Can’t edit the code, can’t save the code, its stuck in the error state with a massive performance hit.

Its almost like its running two programs at the same time: One with the error and one that works correctly.

I have had this happen to two pens in a row, both of which had errors that happened every window.requestAnimationFrame. Even coming back to it hours later still leaves it in this permeant frozen state, and I need to create a new box.

I have never seen this issue on codepen or, it seems to only happen when working with three.js programs on codesandbox.

I can’t edit my code because of an infinite loop

While we do have infinite loop protection as a configurable option it doesn’t prevent all scenarios where infinite loops can occur, such as with incomplete code. When this happens, you can append runonclick=1 to the editor URL to stop the code from being automatically executed enabling you to edit your code to resolve it. For example: React - CodeSandbox

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.