# \`Effect.\_checkIsReady\` infinite loop when dispose scene with DefaultRenderingPipeline again

**URL:** <https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline-again/53633>\
**Category:** Bugs\
**Tags:** engine\
**Created:** [September 22, 2024, 3:55pm UTC](https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline-again/53633 "2024-09-22T15:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![noname0310](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/noname0310/32/27103_2.png) [@noname0310](https://forum.babylonjs.com/u/noname0310)\
**Post date:** [September 22, 2024, 3:55pm UTC](https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline-again/53633/1 "2024-09-22T15:55:58Z")

</div>

This issue is followed by:

> [@\`Effect.\_checkIsReady\` infinite loop when dispose scene with DefaultRenderingPipeline](https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline/52112):
>
> The code to reproduce the bug is very short. const canvas = document.createElement("canvas"); const engine = new Engine(canvas); const scene = new Scene(engine); new DefaultRenderingPipeline("default", true, scene); scene.dispose(); engine.dispose(); After running the above code, the infinite setTimeout loop will run. [image] Here is the repository to reproduce the bug. I’ve kept the things minimal. If you dispose the engine and scene immediately after creating them, the effect will wait …

Here’s the code to reproduce the bug

```typescript
const canvas = document.createElement("canvas");
const engine = new Engine(canvas);
const scene = new Scene(engine);
const defaultPipeline = new DefaultRenderingPipeline("default", true, scene);
defaultPipeline.prepare(); // uncomment this line to fix the issue

scene.dispose();
engine.dispose();

```

You can see it’s running in an infinite setTimeout loop like this

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/4/34beb8539535c3c7fd1cf4ea2824568e6c67fe26.png)

Here is the code to reproduce the issue for debugging.

> **[GitHub - noname0310/babylonjs-disposetest](https://github.com/noname0310/babylonjs-disposetest)**
>
> Contribute to noname0310/babylonjs-disposetest development by creating an account on GitHub.

_Just in case you’re wondering if there’s any reason to write code to delete the engine as soon as it’s created.  
I’m using babylon.js in react and I have some engine initialization code in useEffect callback where [react’s strictmode is running a side effect twice and disposing of the first one.](https://react.dev/reference/react/StrictMode#fixing-bugs-found-by-re-running-effects-in-development)_

```auto

```

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [September 23, 2024, 8:43am UTC](https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline-again/53633/2 "2024-09-23T08:43:40Z")

</div>

This PR should fix the problem:

> <https://github.com/BabylonJS/Babylon.js/pull/15607>
>
> See https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose…-scene-with-defaultrenderingpipeline-again/53633

---

<div class="post-metadata">

**Author:** ![noname0310](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/noname0310/32/27103_2.png) [@noname0310](https://forum.babylonjs.com/u/noname0310)\
**Post date:** [September 23, 2024, 8:48am UTC](https://forum.babylonjs.com/t/effect-checkisready-infinite-loop-when-dispose-scene-with-defaultrenderingpipeline-again/53633/3 "2024-09-23T08:48:44Z")

</div>

Thanks and good morning 🙂
