# How to fully recover a playground that is stuck in an infinite loop (Chrome)?

**URL:** <https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887>\
**Category:** Tutorials and tips\
**Tags:** playground\
**Created:** [June 8, 2025, 11:01am UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887 "2025-06-08T11:01:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [June 8, 2025, 11:01am UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887/1 "2025-06-08T11:01:21Z")

</div>

Hi everyone,

OMG. I have been working on some code in the playground. I almost had just lost some hours of work because of a really stupid mistake that got me stuck in an infnite while-loop 🤦‍♂️

Credits to [this guy](https://barker.codes/blog/how-to-stop-an-infinite-loop-in-chromium/). But I do believe this is definitely worth sharing here too:

1. Open DevTools
2. Open the Sources panel
3. Click _Pause_. The button changes to _Resume Script Execution_.
4. Click and hold _Resume Script Execution_. Then choose _Stop Current JavaScript Call_. It is the little square in the drop-down.

Phew…

Best wishes  
Joe

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [June 8, 2025, 12:39pm UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887/2 "2025-06-08T12:39:14Z")

</div>

This has happened to me a lot of times and unfortunately I was never able to open the dev tools (maybe it’s MacOS specific). It would be pretty cool to save the PG to localstorage before it is executed so in such cases it can be restored manually.

Thanks for the tip anyway! 👍🫡 I bet it will save somene’s bacon for sure 🙈😎

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [June 9, 2025, 5:37am UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887/3 "2025-06-09T05:37:33Z")

</div>

If I open DevTools in advance, it works, but  
when I open DevTools during an infinite loop, it doesn’t change from `pause` to `Resume Script Execution`.  
in case window chrome (About the Lost PG 🥲)

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [June 9, 2025, 2:48pm UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887/4 "2025-06-09T14:48:12Z")

</div>

> [@roland](#):
>
> It would be pretty cool to save the PG to localstorage before it is executed so in such cases it can be restored manually.

@Deltakosh I’ll create a PR if you guys are OK with this.

Regarding the PG GUI:

1. add a checkbox to toggle storing the code (default ON), placed here:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/d/fd4ac31144bb2c873c5aa3f4829c7820ff7b44ab.png)
2. maybe set the limit how many PGs can be stored (LIFO), defaulting to 20? Since this would be used just for recovery, maybe we don’t even need this input and we could hardcode this value.

Restoring the PG would be done manually. (docs)  
We can upgrade the GUI later – to be nicer 😃 to the programmers and give them a more user friendly tool to browse/restore the stored PGs.

I’d like to add that I know about your policy to not store anything (or only the absolute minimum) in the user’s browser storage. This is an edge/emergency case and needs to be really considered to make an exception from this rule.

---

<div class="post-metadata">

**Author:** ![withADoveInOneHand](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/withadoveinonehand/32/1243_2.png) [@withADoveInOneHand](https://forum.babylonjs.com/u/withADoveInOneHand)\
**Post date:** [June 9, 2025, 5:32pm UTC](https://forum.babylonjs.com/t/how-to-fully-recover-a-playground-that-is-stuck-in-an-infinite-loop-chrome/58887/5 "2025-06-09T17:32:47Z")

</div>

I think I have deeply internalized not programming in the playground from past mishaps.
