godot: v3.3.2 HTML5 Regular export not stable on mobile browsers, WASM crash on page reload, cowdata.h:142:set() - FATAL: Index p_index = 0 is out of bounds

Godot version

v3.3.2.stable.official

System information

Windows 10, GLES2, issues reproduced on Android, Google Chrome and Webinspector

Issue description

HTML5 export, default export templates, desktop works fine but I can’t get it to work stable on mobile browsers. First load will work, but once page is reloaded a few times, the error below will print in console and “unreachable” will be shown instead of the game. In order to open the game again, it must be done on another tab. Clearing cookies doesn’t help. Once the issue happens on a single tab, no matter how many times page is reloaded, game will not load, it will keep saying “unreachable” and error below will be shown in console. I tried serving with disabled caching as well, and saw 200 response on each request but same issues were still happening.

--------------------
**ERROR**: FATAL: Index p_index = 0 is out of bounds (size() = 0).
--------------------
   At: ./core/cowdata.h:142:set() - FATAL: Index p_index = 0 is out of bounds (size() = 0).
--------------------
exception thrown: RuntimeError: unreachable,RuntimeError: unreachable
    at <anonymous>:wasm-function[47963]:0x9da0b2
    at <anonymous>:wasm-function[47958]:0x9d9ece
    at <anonymous>:wasm-function[29104]:0x53a31f
    at <anonymous>:wasm-function[33748]:0x75366d
    at <anonymous>:wasm-function[20777]:0x38fc87
    at <anonymous>:wasm-function[43093]:0x8a381d
    at _j (<anonymous>:wasm-function[16693]:0x2cd806)
    at $j (<anonymous>:wasm-function[27629]:0x4caa5e)
    at Module._main (http://192.168.2.14/index.js:9:331320)
    at Object.callMain (http://192.168.2.14/index.js:9:336232)
--------------------
unreachable
--------------------

issue with similar behaviour can be reproduced when Script Export Mode is set to Compile or when game is exported as Debug but error will include “function signature mismatch” without much more info, same is displayed instead of the game. Snippet below is with Debug Export and Compiled Script Export Mode

--------------------
exception thrown: RuntimeError: function signature mismatch,RuntimeError: function signature mismatch
    at godot_js_main(int, char**) (<anonymous>:wasm-function[11302]:0x21d83b)
    at main (<anonymous>:wasm-function[23629]:0x58e715)
    at Module._main (http://192.168.2.14/index.js:9:331562)
    at Object.callMain (http://192.168.2.14/index.js:9:336474)
    at http://192.168.2.14/index.js:684:28
    at new Promise (<anonymous>)
    at http://192.168.2.14/index.js:679:14
--------------------
function signature mismatch
--------------------

I think that it’s easier to reproduce on a faster phone. I might be totally wrong on this and it might be my specific use case, but few slower test phones I have play the game way better than my POCO X3 PRO (Snapdragon 860, Adreno 640). Issue is reproduced just fine on galaxy s9 as well. The issue could possibly have something to do with the fact that page loads quick, but I might be totally wrong on this.

Steps to reproduce

  1. Create an empty project
  2. add Node2D
  3. save current scene
  4. play scene
  5. follow prompt to make the saved scene the main scene
  6. make sure game runs in editor
  7. Add HTML5 export, download export templates when prompted if needed
  8. Apply following settings -> Options tab -> Regular Export Type Variant; Script tab -> Text Script Export Mode
  9. Export without debug (exporting with debug will result in same behaviour but different error without much info, but containing “function signature mismatch”)
  10. create export dir and export project as index.html in that export dir.
  11. serve the export directory (containing index.html) your preferred way (quick way I use (python or python3): python -m http.server --bind 0.0.0.0 80 )
  12. check your local ip your preferred way (for example ifconfig in cmd or ipconfig in terminal)
  13. visit via google chrome and use remote debugging to see console logs or use app like Webinspector to access the game and the see console logs in the app.
  14. reload the page few times

Minimal reproduction project

bugrepro.zip

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Webinspector - ISSUE REPRODUCED Chrome - ISSUE REPRODUCED DuckDuckGo - ISSUE REPRODUCED Brave - ISSUE REPRODUCED

Indeed, those are all chromium based browsers.

exporting same project with 3.2 removes the issue for my project on chrome.

Yes, potentially 3.3 does something that triggers the memory corruption in the browser. But it still seems a browser issue to me. Again, if the first load works. The engine is doing fine. If reloading does not, it’s a browser fault because from the application point of view the first load and the second must be identical. Especially after clearing the cache like mentioned in the OP.