TannerRogalsky / love.js

LÖVE ported to the web using Emscripten
MIT License
493 stars 53 forks source link

Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once #32

Closed spectrenoir06 closed 7 years ago

spectrenoir06 commented 8 years ago

The game work in debug mode and release-compatibility but if open the page a second time have got this error

Error: [string "boot.lua"]:229: Already initialized
stack traceback:
    [C]: in function 'init'
    [string "boot.lua"]:229: in function <[string "boot.lua"]:223>
    [C]: in function 'xpcall'
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.
Error: [string "boot.lua"]:229: Already initialized
stack traceback:
    [C]: in function 'init'
    [string "boot.lua"]:229: in function <[string "boot.lua"]:223>
    [C]: in function 'xpcall'
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.
Uncaught abort("Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.") at Error
    at jsStackTrace (http://localhost:8000/love.js:1:17162)
    at stackTrace (http://localhost:8000/love.js:1:17345)
    at abort (http://localhost:8000/love.js:24:15936)
    at assert (http://localhost:8000/love.js:1:7547)
    at _emscripten_set_main_loop (http://localhost:8000/love.js:1:70494)
    at _emscripten_set_main_loop_arg (http://localhost:8000/love.js:1:281879)
    at Object.bl [as _main] (http://localhost:8000/love.js:6:1273)
    at Object.callMain (http://localhost:8000/love.js:24:14316)
    at Object.Module.setStatus (http://localhost:8000/:1288:22)
    at http://localhost:8000/love.js:24:15162
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
Uncaught abort("Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.") at Error
    at jsStackTrace (http://localhost:8000/love.js:1:17162)
    at stackTrace (http://localhost:8000/love.js:1:17345)
    at abort (http://localhost:8000/love.js:24:15936)
    at assert (http://localhost:8000/love.js:1:7547)
    at _emscripten_set_main_loop (http://localhost:8000/love.js:1:70494)
    at _emscripten_set_main_loop_arg (http://localhost:8000/love.js:1:281879)
    at Object.bl [as _main] (http://localhost:8000/love.js:6:1273)
    at Object.callMain (http://localhost:8000/love.js:24:14316)
    at Object.Module.setStatus (http://localhost:8000/:1288:22)
    at window.onerror (http://localhost:8000/:1304:16)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
'webkitMovementX' is deprecated. Please use 'movementX' instead.
'webkitMovementY' is deprecated. Please use 'movementY' instead.
spectrenoir06 commented 8 years ago

I'ts only appear in release-compatibility

TannerRogalsky commented 8 years ago

@spectrenoir06 Can you give me a test case for this? And can you elaborate on what you mean by opening the page a second time?

spectrenoir06 commented 8 years ago

I try with this

function love.load()
    print("hello")
end

first time this error

capture d ecran de 2016-03-13 15 40 20

second time working no error

third time and all the othertime same error than first time

if you add a love.update() and a love.draw() it make the error after one frame

TannerRogalsky commented 8 years ago

I can't reproduce this. Can you try clearing your cache and trying again? Maybe you have some bad data hanging around somehow.

spectrenoir06 commented 8 years ago

i try in incognito mode it work the first time and second time but after the error reappear

  1. work ( first time)
  2. work
  3. error
  4. error
  5. work
  6. error

I use Chromium version 48.0.2564.82 Ubuntu 15.04 (64-bit)

with the same code

function love.load()
    print("hello")
end
TannerRogalsky commented 8 years ago

I haven't test this on Linux much. I don't have a native install and graphics stuff runs slow in my VM. I'll look into this when I get a chance.

spectrenoir06 commented 8 years ago

I test with this code and i have 3 different behavior ( just refreshing the page )

function love.load()
    print("load")
    i = 0
end

function love.update(dt)
 i = i + 1
 print("update", i)  
end

function love.draw()
    print("draw", i)
    love.graphics.print(i, 10, 10)
end

capture d ecran de 2016-03-13 18 20 38 capture d ecran de 2016-03-13 18 22 20 capture d ecran de 2016-03-13 18 22 28

DeejayArroba commented 8 years ago

I'm also having this issue (on ubuntu 15.10). Seems to happen randomly on chromium, but on firefox it works fine all the time.

spectrenoir06 commented 8 years ago

same on linux with google chrome Version 49.0.2623.108 (64-bit)

wesleywerner commented 8 years ago

Thought I'd provide a better test case. I'd be happy to help out if extra steps are needed.

Create a basic program

angle = 0

function love.load (args)
  love.graphics.setBackgroundColor({128, 192, 64})
end

function love.update (dt)
  angle = (angle + dt) % 360
end

function love.draw ()
  love.graphics.setColor({64, 128, 192})
  love.graphics.circle("fill", 100, 150 + (math.sin(angle)*50), 50)
end

Build from the debug/ directory: python ../emscripten/tools/file_packager.py game.data --preload /home/kbmonkey/coding/love/tests/basic@/ --js-output=game.js

Copy game.* to release-compatibility/ and release-performance/

Run python -m SimpleHTTPServer for each case.

release-compatibility

  1. Open a new Chrome browser in Incognito mode
  2. Initial loads always seems to work
  3. Refresh the page
  4. Fails to load 8/10 times (sporadic)
  5. Close the incognito window
  6. Repeats from no 1

The fact that the first load from incognito seems to work indicates a caching issue in the chrome process. This seems to persist between browsing sessions in non-incognito mode, pointing again to a caching side-effect.

Iceweasel/Firefox does not exhibit this behaviour. 10/10.

release-performance

  1. Open a new Chrome browser in Incognito mode
  2. Initial loads always seems to work
  3. Refresh the page
  4. No problems 10/10 times

Error

Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.abort @ love.js:24assert @ love.js:1_emscripten_set_main_loop @ love.js:1_emscripten_set_main_loop_arg @ love.js:1bl @ love.js:6callMain @ love.js:24Module.setStatus @ (index):61(anonymous function) @ love.js:24
love.js:24 Uncaught abort("Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.") at Error
    at jsStackTrace (http://localhost:8000/love.js:1:17162)
    at stackTrace (http://localhost:8000/love.js:1:17345)
    at abort (http://localhost:8000/love.js:24:15936)
    at assert (http://localhost:8000/love.js:1:7547)
    at _emscripten_set_main_loop (http://localhost:8000/love.js:1:70494)
    at _emscripten_set_main_loop_arg (http://localhost:8000/love.js:1:281879)
    at Object.bl [as _main] (http://localhost:8000/love.js:6:1273)
    at Object.callMain (http://localhost:8000/love.js:24:14316)
    at Object.Module.setStatus (http://localhost:8000/:61:20)
    at http://localhost:8000/love.js:24:15162
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.callMain @ love.js:24Module.setStatus @ (index):61(anonymous function) @ love.js:24

System and Browser Versions

TannerRogalsky commented 8 years ago

Wow! I appreciate the excellent error reporting, @wesleywerner! To be honest, I have no idea what is causing this but I've seen it on OSX as well (although I think it happens less frequently than on Linux). I will try to ask some emscripten devs if they have any insight.

Thanks, man!

profan commented 7 years ago

Anything new here? Still in this swamp here as well!

TannerRogalsky commented 7 years ago

I haven't seen this happen at all in 0.11. I think this is resolved by the new version.