godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.35k stars 21.06k forks source link

HTML5 Mono builds stall during initialization since 3.2.4 RC 4 #47048

Closed ZwieBit closed 3 years ago

ZwieBit commented 3 years ago

Godot version: RC5 (from RC2 on)

OS/device including version: IntelGraphics 655, GLES2

Issue description: When i try to test a project with html5 export settings, the site ist halted and does not respond.

Current status (>RC2) image

Edit fales: after force-stopping the script

Script terminated by timeout at:
Godot/Module.then@http://0.0.0.0:8060/tmp_js_export.js:9:422409
promise callback*doInit@http://0.0.0.0:8060/tmp_js_export.js:615:21
init@http://0.0.0.0:8060/tmp_js_export.js:631:19
startGame@http://0.0.0.0:8060/tmp_js_export.js:727:11
@http://0.0.0.0:8060/tmp_js_export.html:222:12
@http://0.0.0.0:8060/tmp_js_export.html:242:5

Expected behaviour (RC1) image

~When i try to run the export in nginx i get the following error: image~ workaround applied via #47191

Steps to reproduce: Download Project "GUI Theming Override" and Export it to HTML5

Minimal reproduction project: Just download "GUI Theming Override" e.g.

akien-mga commented 3 years ago

I can't seem to reproduce the issue, it loads fine for me in Firefox Nightly and latest Chrome stable, at least when served by Godot's localhost server (one click deploy).

ZwieBit commented 3 years ago

In firefox and with internal server i get a rotating loading screen which stops after some seconds. image

Tried changing my settings to english. image

Faless commented 3 years ago

When i try to run the export in nginx i get the following error:

The host is not returning the correct mime type for the wasm file.

bruvzg commented 3 years ago

Can't reproduce it with exports from the classic Godot editor, but it is reproducible with Mono editor (exporting non-Mono project or Mono project), macOS 11.2.3 (Chromium 91 and Firefox 86).

ZwieBit commented 3 years ago

Nice! Didn't test that... for me exactly the same - html5 export without mono works as expected!

neikeq commented 3 years ago

Did we change Mono or emsdk version between RC1 and RC2?

Faless commented 3 years ago

@neikeq not that I remember, all the changes happened before RC1 (end December, early Jan). @akien-mga anything comes to mind?

fenix-hub commented 3 years ago

I'm having this same issue trying to run a very simple project on RC6 (not mono version). I'm trying to run a scene with a Control node and a custom node using a plugin of mine.

Here's what happens if exporting for HTML5 and using xampp 2021-03-20_20-44

Here's using godot server (the whole browser is completely stuck, cannot even open console) 2021-03-20_20-37

Could be unrelated, but the same issue happens on Android. On windows and linux (only platforms I can test) everything looks fine.

Here's the project if it could help reproduce this easycharts.zip

Also here it is the already exported files for HTML5 easycharts.zip

note: I tried to make sure that the plugin didn't have any bug causing errors. Also, the plugin shouldn't have any function specifically indicated as not working on these platforms

Faless commented 3 years ago

@fenix-hub see my comment above, server is not returning the right headers: https://github.com/godotengine/godot/issues/47048#issuecomment-800155862 and this PR #47191 .

fenix-hub commented 3 years ago

@Faless Sorry, missed that message. Thanks :)

ZwieBit commented 3 years ago

Damit, i'm so sorry. I just retested "GUI Theming Override" with different combinations, i think i made a mistake - Actually it works up until RC2. From RC3 on i get problem:

RC3 (internal server & nginx) image

Before it works with nginx and internal.

ZwieBit commented 3 years ago

RC4 RC5 RC6 internal server: not responding / no message

nginx: image

Calinou commented 3 years ago

@ZwieBit You need to configure the web server to serve the .wasm file with the correct MIME type. GitHub Pages and itch.io do this automatically, but some development web servers don't.

ZwieBit commented 3 years ago

@ZwieBit You need to configure the web server to serve the .wasm file with the correct MIME type. GitHub Pages and itch.io do this automatically, but some development web servers don't.

So why did this then actually work with RC1 and RC2? I'll give it a try and research for the configuration.

Edit: Well, actually you got me ;-) I already used nginx for Blazor-Development, so it was configured and .wasm should be clearly working i think. But i will research a little further, maybe it's just a misconfiguration on nginx and completely unrelated to the internal server problem.

Edit2: I'm fiddling around but i'm completely lost and unsure why this happens; sorry but i'm actually not a sysadmin ;-) Guess i can't help and test much more. I would say it's just a follow up error because of the "function signature mismatch".

RC2 image

RC6 image

Faless commented 3 years ago

So why did this then actually work with RC1 and RC2? I'll give it a try and research for the configuration.

Because it used the slow instantiation method that did not require the mime type. As mentioned above, I've made a workaround for it for future releases.

I would say it's just a follow up error because of the "function signature mismatch".

This is a cache problem 90% of the time, so, always try clearing your cache when you get this error.

akien-mga commented 3 years ago

Adding the error message in plain text as screenshots are not searchable:

Uncaught (in promise) TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
Faless commented 3 years ago

@akien-mga That issue is fixed by #47191 , The function signature mismatch is probably a cache issue. I'm going to close this, but feel free to comment if you think the issue is still valid.

ZwieBit commented 3 years ago

i know i'm a bit annoying ;-) So #47191 does also eliminate the problem with the internal server of godot, not only external ones?

Faless commented 3 years ago

@ZwieBit what error are you getting when running the internal server in RC6?

ZwieBit commented 3 years ago

RC4 RC5 RC6 internal server: not responding / no message

nginx: image

On RC3 "function mismatch with wasm" - from RC4 onwards its simply not showing any output in edge, firefox, chromium - just not responding. I can reproduce it with every PC - just using godot-mono with a simple spatial and do a htlm5 export. I'll check this further....

Faless commented 3 years ago

Mono build stalls during emscripten initialization. I can't seem to be able to get a proper trace, just:

Script terminated by timeout at:
Godot/Module.then@http://0.0.0.0:8060/tmp_js_export.js:9:422409
promise callback*doInit@http://0.0.0.0:8060/tmp_js_export.js:615:21
init@http://0.0.0.0:8060/tmp_js_export.js:631:19
startGame@http://0.0.0.0:8060/tmp_js_export.js:727:11
@http://0.0.0.0:8060/tmp_js_export.html:222:12
@http://0.0.0.0:8060/tmp_js_export.html:242:5

after force-stopping the script

akien-mga commented 3 years ago

So to clarify (as @Faless and I spent some time looking at changes from RC 1 to RC 2...), the regression happened in 3.2.4 RC 3. So:

We also confirmed that it's not related to changes in the build containers, as rebuilding RC 1 and RC 2 with the current containers also makes it work fine.

I initially suspected a regression from the Thread modernization changes in #45618 merged in RC 3, as I know it has caused other issues and Mono threads are somewhat touchy.

But after doing some test builds, it seems #45618 is not directly involved:

Note 2: Both builds have sound disabled as there were issues building the newly added alsa wrapper at these commits.

So here's the list of potential commits that introduced this regression: https://github.com/godotengine/godot/compare/220f24c191149444dfd34d03d22d4e451dfcaa49...4f891b706027dc800f6949bec413f448defdd20d


Some more testing:

akien-mga commented 3 years ago

Testing further, I found that 3.2.4 RC 3 is actually good (no regression). It's a bit tricky as 3.2.4 RC 3 was affected by another bug that broke the HTML5 export (#46352), but when rebuilding it with the relevant fix, there's no problem starting a Mono export.

I could confirm the Mono build stall in 3.2.4 RC 4 on the other hand.

So the problem actually happened between 3.2.4 RC 3 and 3.2.4 RC 4.

Relevant changes: https://github.com/godotengine/godot/compare/4f891b706027dc800f6949bec413f448defdd20d...dc99f04d51d6556e5ba4d9cfcce8117d168ac6f1


Edit: Bisecting further:

So the culprit is now in https://github.com/godotengine/godot/compare/08898e97a432e21cec79d6386b24980b8bd76745...82fcd3a7b8932908abc1c774979186c4adce861e

Faless commented 3 years ago

8a020a6573109820f4326b085f1264daedb8ff98 is good

So, unless I made a mistake: https://github.com/godotengine/godot/compare/8a020a6573109820f4326b085f1264daedb8ff98...82fcd3a7b8932908abc1c774979186c4adce861e

akien-mga commented 3 years ago

Bisecting even further, this appears to be a regression from #46731 (merge commit 82fcd3a7b8932908abc1c774979186c4adce861e is bad, parent commit f477d3ca9851953ded5f0560081d726f5de9b534 is good).