alexkehayias / chocolatier

WIP ClojureScript game/engine using Pixi.js for rendering.
Eclipse Public License 1.0
429 stars 29 forks source link

Figwheel times out and crashes browser tab when dereferencing *state* from REPL #8

Closed aeberts closed 8 years ago

aeberts commented 9 years ago

Figwheel times out and crashes the Chrome browser tab when dereferencing state from REPL while the chocolatier demo game is running.

In the terminal:

➜  chocolatier git:(dev) ✗ rlwrap lein figwheel

(Connect browser to running figwheel process...)

cljs.user=> (in-ns 'chocolatier.engine.core)
nil
chocolatier.engine.core=> *state*
Eval timed out!

The browser tab becomes unresponsive and Chrome must be "force shutdown"ed from Activity Monitor.

alexkehayias commented 9 years ago

Dereferencing an atom would be @state or (deref state)

Can you try that? I think I've seen that before and it was something to do with reading an atom without dereferencing.

On Saturday, September 12, 2015, Alexander Eberts notifications@github.com wrote:

Figwheel times out and crashes the Chrome browser tab when dereferencing state from REPL while the chocolatier demo game is running.

In the terminal:

➜ chocolatier git:(dev) ✗ rlwrap lein figwheel

(Connect browser to running figwheel process...)

cljs.user=> (in-ns 'chocolatier.engine.core)nil chocolatier.engine.core=> state Eval timed out!

The browser tab becomes unresponsive and Chrome must be "force shutdown"ed from Activity Monitor.

— Reply to this email directly or view it on GitHub https://github.com/alexkehayias/chocolatier/issues/8.

aeberts commented 9 years ago

facepalm - oops, silly me.

dereferencing the atom correctly gives the same result:

cljs.user=> (in-ns 'chocolatier.engine.core)
nil
chocolatier.engine.core=> (deref *state*)
Eval timed out!

Config:

alexkehayias commented 9 years ago

I was able to recreate the issue. This seems to have changed recently. One additional piece of info in my repl was this: Sun Sep 13 00:49:19 EDT 2015 [server-loop] WARN - opcode mismatch: pre: 1, now: 0

Looks like some sort of endless loop going on caused by the :replay system. Commenting it out in the :scene in chocolatier.game fixes the issue. Probably because it is self referential (the state references the state) and it no longer works in the latest cljs.

aeberts commented 9 years ago

Commenting out references to replay in chocolatier.game doesn't fix the issue on my side.

I noticed there were two references to the replay system in chocolatier.game (one in the scene and one defining the replay system itself on line 104). I tried commenting out just the reference to replay in the scene and I'm still getting:

cljs.user=> (in-ns 'chocolatier.engine.core)
nil
chocolatier.engine.core=> @*state*
Sun Sep 13 09:05:53 PDT 2015 [server-loop] WARN - opcode mismatch: pre: 1, now: 0
Eval timed out!

Commenting out both references also gives the same result. Each time I stopped the figwheel server and did a lein clean just in case something was getting cached somewhere.

Anything else I should try?

alexkehayias commented 9 years ago

Interesting! Not sure it worked for me then. I only commented it from the :scene and saved the file which causes figwheel to resart the game loop. Will try to recreate.

On Sunday, September 13, 2015, Alexander Eberts notifications@github.com wrote:

Commenting out references to replay in chocolatier.game doesn't fix the issue on my side.

I noticed there were two references to the replay system in chocolatier.game (one in the scene and one defining the replay system itself on line 104). I tried commenting out just the reference to replay in the scene and I'm still getting:

cljs.user=> (in-ns 'chocolatier.engine.core) nil chocolatier.engine.core=> @state Sun Sep 13 09:05:53 PDT 2015 [server-loop] WARN - opcode mismatch: pre: 1, now: 0 Eval timed out!

Commenting out both references also gives the same result. Each time I stopped the figwheel server and did a lein clean just in case something was getting cached somewhere.

Anything else I should try?

— Reply to this email directly or view it on GitHub https://github.com/alexkehayias/chocolatier/issues/8#issuecomment-139892279 .

alexkehayias commented 8 years ago

I pushed a branch where this is fixed for me issue-8 by removing the replay system. I wasn't able to reproduce what you're seeing after removing the replay system.

  1. lein figwheel
  2. Open a browser to http://127.0.0.1:3449
  3. In the repl (in-ns 'chocolatier.engine.core)
  4. (keys @*state*)
aeberts commented 8 years ago

I ran the above in the issue-8 branch and the issue appears to be fixed. Thanks Alex!