godotengine / godot

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

macOS Safari 16.1 (latest version) - all HTML5 exports crash on loading (even empty projects with default settings) #67949

Open NianoTT opened 1 year ago

NianoTT commented 1 year ago

Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

3.5.1, 3.4.5

System information

macOS Monterey 12.6.1, Safari 16.1

Issue description

Since the update to Safari 16.1 on macOS (Macbook Pro early 2015, macOS 12.6.1), every Godot HTML5 export (GLES2 and GLES3) crashes on loading, even empty projects with no settings changed.

It looks exactly like in the video in this report: https://github.com/godotengine/godot/issues/62445 and might be a similar issue. I can not check it on iOS as I don't have a device capable of running the latest version.

This basically prevents any Godot game from running on a Mac with the latest Safari version.

Steps to reproduce

Minimal reproduction project

any project, even empty (main scene with one Node2D)

NianoTT commented 1 year ago

Update: same happens with Gnome Web version 43.0, which also uses the WebKit rendering engine.

Faeovin commented 1 year ago

I can confirm this, all Godot web builds crash with Safari Browser 16.1

If anyone knows how to fix this, please tell as this is very detrimental to any web game made with Godot.

Fran6nd commented 1 year ago

Same here with Godot 4 and the latest beta. Working fine on windows/linux web browser.

Calinou commented 1 year ago

Update: same happens with Gnome Web version 43.0, which also uses the WebKit rendering engine.

Please report this to WebKit upstream, as this is a regression on their end. Also, open the developer tools then reload the page to get a full error log.

NianoTT commented 1 year ago

Please report this to WebKit upstream, as this is a regression on their end. Also, open the developer tools then reload the page to get a full error log.

This was tested by someone else I asked, I don't have Gnome installed myself.

Maybe someone reading this can report it there? Otherwise I'll install it and get the error log myself.

akien-mga commented 1 year ago

Could affected users provide some more information on what issue you're experiencing exactly?

karlcow commented 1 year ago

More information would help create a bug report on https://bugs.webkit.org/

Thanks for the heads up.

asmaloney commented 1 year ago

(Adding info from a mastodon chat with Rémi.)

On both machines it loads with both GLES2 and GLES3.

GLES2 Screen Shot 2022-11-16 at 06 56 23

GLES3 Screen Shot 2022-11-16 at 06 57 08

@akien-mga pointed out the the GLES3 problem with the shading is probably this one.

NianoTT commented 1 year ago

Could affected users provide some more information on what issue you're experiencing exactly?

* macOS or iOS version, architecture, GPU

mac OS 12.6.1, Intel, Macbook Pro early 2015, GPU: Intel Iris 6100 1.5GB

* Browser versions, and exact symptoms for each browser (seems like it might be crashing on Chrome but not Safari?)

Safari 16.1:

Chrome:

* Reproducible with GLES2, GLES3, or both?

both

* Does the Web editor work? https://editor.godotengine.org/

same crash with Safari

* Do you have a reproducer online that crashes for you?

everything, your test project crashes

* Does it crash on all Apple hardware you have available, or just specific devices?

I only have this one Apple device

* For each buggy scenario, can you open the dev console and retrieve logs to attach here?

It only prints:

Godot Engine v3.5.1.stable.official.6fed1ffa3 - https://godotengine.org/
OpenGL ES 2.0 Renderer: WebKit WebGL

Also does not load on Gnome Web (uses WebKit) on Linux the same way on my PC.

I've been asking others to try, and it seems to not affect everyone, some don't have the issue on Apple hardware. I thought it might be GPU driver related, but that would not explain why Gnome on Linux is also affected (AMD 3800x CPU, 1080ti GPU).

akien-mga commented 1 year ago

Also does not load on Gnome Web (uses WebKit) on Linux the same way on my PC.

I just tried Gnome Web/Epiphany on Linux (version 43.0), and I can reproduce some issues, though I can't say if it's the same as on Safari and/or Chrome on macOS:

[Log] Godot Engine v3.5.1.stable.official.6fed1ffa3 - https://godotengine.org (tmp_js_export.js, line 354)
[Log] OpenGL ES 2.0 Renderer: WebKit WebGL (tmp_js_export.js, line 354)
[Error] WARNING: GL_INVALID_VALUE: A numeric argument is out of range.
[Error]    at: gl_check_errors (drivers/gles2/rasterizer_gles2.cpp:491) - GL_INVALID_VALUE: A numeric argument is out of range.
[Log]   (tmp_js_export.js, line 354)
[Log] Level: (1, 1) path: res://stages/world_1/intro.tscn (tmp_js_export.js, line 354)
[Log] Level: (1, 2) path: res://stages/world_1/forest_fun.tscn (tmp_js_export.js, line 354)
[Log] Level: (1, 3) path: res://stages/world_1/roller_coaster.tscn (tmp_js_export.js, line 354)
[Log] Level: (1, 4) path: res://stages/gcon/demo_gcon_004.tscn (tmp_js_export.js, line 354)
[Log] Level: (1, 5) path: res://stages/gcon/demo_gcon_006.tscn (tmp_js_export.js, line 354)
[Error] WebGL: INVALID_ENUM: bindTexture: invalid target
[Error] WebGL: INVALID_ENUM: texParameter: invalid texture target
[Error] WebGL: INVALID_ENUM: texParameter: invalid texture target

... and more ...

Full log with stacktraces for the errors: epiphany-error-log-webgl1.log

Worth noting that the process doesn't crash, the music of the main menu actually plays, but nothing renders. Click randomly seems to trigger game logic, still without rendering.

BTW pro-tip for Epiphany, as they don't seem to mention it anywhere and it's not accessible from the menus: the hotkey for the dev tools is Ctrl+Shift+I, like in Chromium.

akien-mga commented 1 year ago

WebKit bug report: https://bugs.webkit.org/show_bug.cgi?id=247860

akien-mga commented 1 year ago

If needed for testing, I've uploaded WebGL 1.0 and 2.0 builds of Jetpaca from Godot 3.5.1:

And for non Godot users some steps to reproduce to export a project locally and see if the bug(s) is (are) reproducible: https://bugs.webkit.org/show_bug.cgi?id=247860#c9

Scony commented 1 year ago

I've seen the issue with black materials on my iPhone with safari using WebKit 605/604.

I've briefly checked if this reproduces on the WPE WebKit port on Linux, and with the latest WebKit from main, I couldn't reproduce it. In the upcoming days I'll try to reproduce it on linux, on older branches (corresponding to WebKit 605/604 the Safari uses) and if I succeed it will mean that the issue is WebKit-specific. That would make it possible for me to narrow down and fix hopefully.

clayjohn commented 1 year ago

In the upcoming days I'll try to reproduce it on linux, on older branches (corresponding to WebKit 605/604 the Safari uses) and if I succeed it will mean that the issue is WebKit-specific. That would make it possible for me to narrow down and fix hopefully.

If it helps, I was able to reproduce a black screen issue on Lubuntu using the resources Akien linked above (i.e. using the Gnome Web browser which is Webkit based, and running the jetpaca demo). Interestingly, I did not get any errors reported in the console.

MaxFletcher commented 1 year ago

If needed for testing, I've uploaded WebGL 1.0 and 2.0 builds of Jetpaca from Godot 3.5.1:

* WebGL 1.0: https://akien.itch.io/jetpaca

* WebGL 2.0: https://akien.itch.io/jetpaca-webgl2

And for non Godot users some steps to reproduce to export a project locally and see if the bug(s) is (are) reproducible: https://bugs.webkit.org/show_bug.cgi?id=247860#c9

Sorry if I am misunderstanding something, but I wanted to give it a try just to see if I could replicate it, but both of these load and play fine on my Macbook.

macOS 12.6.1 Safari Version 16.1 (17614.2.9.1.13, 17614) Macbook Pro 2020 (intel)

SysError99 commented 1 year ago

All WebGL games crash almost immediately, some WebGL2 games work (through WebGL2 experimental option), but presented with black screen, some WebGL2 games either reported losing WebGL context due to shader compilation crash, or crash and immediate website refresh.

iPadOS 15.7.1 (19H117) Safari Version: same as iPadOS iPad Mini (4th generation)

djg commented 1 year ago

@akien-mga @NanitesNanites When the page crashes in Safari 16.1, is there an associated crash in console.app > Crash Reports > com.apple.WebKit.WebContent?

NianoTT commented 1 year ago

@akien-mga @NanitesNanites When the page crashes in Safari 16.1, is there an associated crash in console.app > Crash Reports > com.apple.WebKit.WebContent?

@djg Yes, I attached it.

com.apple.WebKit.WebContent-2022-12-12-010455.000.ips.txt

NianoTT commented 1 year ago

https://bugs.webkit.org/show_bug.cgi?id=247860#c15

Looks like it's fixed on Webkit 👍

Will test when the next Safari Version/Patch is out.

NianoTT commented 1 year ago

Quick update, issue still present in Safari 16.3 on my machine. Don't know if the Webkit fix has been incorporated into Safari yet, at least I couldn't find it in patch notes.

lostminds commented 1 year ago

Exporting a web build from Godot 4.0b17 and testig it in Safari 16.3 on macOS 13.2 I do not get a crash on loading.

However, after the loading bar finishes the game just seems to get stuck processing something with a spinning loading icon (see below) that I haven't seen on any other platform. According to Activity monitor it's doing something, but not very intensely at about 1.5% CPU with little/no memory activity and after waiting 30+ minutes I've seen no change.

Screenshot 2023-02-02 at 15 56 15

ChildLearningClub commented 1 year ago

I get the same infinite spinning disk after the loading bar finishes on ios Safari 16.2 with Godot 4 RC1 with a blank project. Godot 3.5.1 works perfectly fine however.

dragonal42 commented 1 year ago

I get the same !! have you got news about it ?

NianoTT commented 1 year ago

Those who get crashes/infinite loading, can you tell which device/os version you are running? I'm trying to assemble a list of which are affected and which are not, might help the Webkit people to debug it.

dragonal42 commented 1 year ago

Hi thanks a lot ! this is my test site for a simple project with Godot 4 (with RC6 update - the same): https://billiar.info/jeux/tst/ On Edge, Chrome, Opera on windows 11, it is OK, but very long to run a simply project than before (godot 3) ...

and on IOS 16.2 or 16.3.x: with Chrome or Safari the website load, and go to infinity loop ...

i have another project : In Godot 3, and on IOS it is OK : https://billiar.info/jeux/conceptkids/ in Godot 4 (RC3) : on windows it is OK but with a long loading on IOS 16.3.x with Chrome or Safari it is infinity loop : https://billiar.info/jeux/conceptkids4/

dragonal42 commented 1 year ago

Also the sale with final version 4 ! have you create a ticket ?

stefano-elysium commented 1 year ago

We also get this issue, with the error Out Of Memory. I think it is related to the multithreading feature, because Godot 3X works, but if you enable multithreading it gives out the same error. The maximum memory available is 384MB, and I think the initialization code tries to allocate more using sharedarraybuffers. image

stefano-elysium commented 1 year ago

After adding this code to the index.js and limiting the maximum memory, the error is different.

var MEMORY_MAXIMUM;
if( navigator.userAgent.indexOf("iPhone") >= 0 ) {
 MEMORY_MAXIMUM = 402653183 / 65536; //iOS has this wonderful 384mb limit
 console.log("LIMITING MAX MEMORY USAGE TO 384mb BECAUSE iOS")
} else {
 MEMORY_MAXIMUM = 2147483648 / 65536;
}

if (ENVIRONMENT_IS_PTHREAD) {
 wasmMemory = Module["wasmMemory"];
 buffer = Module["buffer"];
} else {
 if (Module["wasmMemory"]) {
  wasmMemory = Module["wasmMemory"];
 } else {
  wasmMemory = new WebAssembly.Memory({
   "initial": INITIAL_MEMORY / 65536,
   "maximum": MEMORY_MAXIMUM,
   "shared": true
  });
  if (!(wasmMemory.buffer instanceof SharedArrayBuffer)) {
   err("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag");
   if (ENVIRONMENT_IS_NODE) {
    console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)");
   }
   throw Error("bad memory");
  }
 }
}

The error becomes: Unhandled Promise Rejection: CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 33425

NianoTT commented 1 year ago

Good news: with Safari 16.4 the crash on loading is fixed!

Would be nice if others that were affected could confirm, since the behaviour seems different between different hardware.

Also sidenote, performance degraded quite a bit with Safari 16.4 compared to 16.0, which was the last version I could use without it crashing on load. It lost at least 25% fps (my test project didn't changed). Guess nothing that can be done from Godot side of things as I'm sure thats a Safari issue, just might be worth mentioning.

karlcow commented 1 year ago

Also sidenote, performance degraded quite a bit with Safari 16.4 compared to 16.0, which was the last version I could use without it crashing on load. It lost at least 25% fps (my test project didn't changed). Guess nothing that can be done from Godot side of things as I'm sure thats a Safari issue, just might be worth mentioning.

@NanitesNanites do you have a specific test to reproduce the loss of performances.

tracked on rdar://107286259 at @Apple

stefano-elysium commented 1 year ago

related #70621

stefano-elysium commented 1 year ago

Good news: with Safari 16.4 the crash on loading is fixed!

I tried on an ipad with 16.4 and it did NOT fix the issue

NianoTT commented 1 year ago

@NanitesNanites do you have a specific test to reproduce the loss of performances.

I just used a level from my game. It's not consitent enough to qualify as a proper benchmark but it did run significantly worse then before.

dragonal42 commented 1 year ago

news: with Safari 16

it is so sad ... the same too : it doesn't work anymore on ios iphone 16.4 : https://billiar.info/jeux/joy/joy.html

in this example, i have test the new addon with "Cross Origin Isolation Service Worker" and it work !!! (without .htaccess modifications) https://godotengine.org/asset-library/asset/1818

wait and see

karlcow commented 10 months ago

@NianoTT Do you or anyone here have a simple example which could show how the performance degraded from Safari 16.0 to Safari 16.4, and if it's better or not for Safari 17 ? Without a concrete measurable example, it's hard to diagnose the exact issue.

dragonal42 commented 10 months ago

More an more bad iOS 17.1 or 17.2 Godot 4.1 or 4.2 doesnt work…

even Godot 3.5.4 who was funcrional in 16.x doesnt work anymore… so sad

exception thrown: TypeError: null is not an object (evaluating 'gl.getContextAttributes().antialias'),createOffscreenFramebuffer@https://billiar.info/jeux/conceptkids/index.js:9:120004 registerContext@https://billiar.info/jeux/conceptkids/index.js:9:126081 createContext@https://billiar.info/jeux/conceptkids/index.js:9:119558 _emscripten_webgl_do_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189241 _emscripten_webgl_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189380 <?>.wasm-function[23471]@[wasm code] <?>.wasm-function[15117]@[wasm code] <?>.wasm-function[22487]@[wasm code] @https://billiar.info/jeux/conceptkids/index.js:9:326105 callMain@https://billiar.info/jeux/conceptkids/index.js:9:331025 @https://billiar.info/jeux/conceptkids/index.js:696:28 Promise@[native code] @https://billiar.info/jeux/conceptkids/index.js:691:25 null is not an object (evaluating 'gl.getContextAttributes().antialias') IMG_8373

SysError99 commented 10 months ago

More an more bad iOS 17.1 or 17.2 Godot 4.1 or 4.2 doesnt work…

even Godot 3.5.4 who was funcrional in 16.x doesnt work anymore… so sad

exception thrown: TypeError: null is not an object (evaluating 'gl.getContextAttributes().antialias'),createOffscreenFramebuffer@https://billiar.info/jeux/conceptkids/index.js:9:120004 registerContext@https://billiar.info/jeux/conceptkids/index.js:9:126081 createContext@https://billiar.info/jeux/conceptkids/index.js:9:119558 _emscripten_webgl_do_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189241 _emscripten_webgl_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189380

.wasm-function[23471]@[wasm code] .wasm-function[15117]@[wasm code] .wasm-function[22487]@[wasm code] @https://billiar.info/jeux/conceptkids/index.js:9:326105 callMain@https://billiar.info/jeux/conceptkids/index.js:9:331025 @https://billiar.info/jeux/conceptkids/index.js:696:28 Promise@[native code] @https://billiar.info/jeux/conceptkids/index.js:691:25 null is not an object (evaluating 'gl.getContextAttributes().antialias') IMG_8373

This was really weird. I have 3.5.3 projects running fine even with iPhone 7. Do you have the specifications of the device? Are there anything that you suspect to be a culprit?

dragonal42 commented 10 months ago

More an more bad iOS 17.1 or 17.2 Godot 4.1 or 4.2 doesnt work… even Godot 3.5.4 who was funcrional in 16.x doesnt work anymore… so sad exception thrown: TypeError: null is not an object (evaluating 'gl.getContextAttributes().antialias'),createOffscreenFramebuffer@https://billiar.info/jeux/conceptkids/index.js:9:120004 registerContext@https://billiar.info/jeux/conceptkids/index.js:9:126081 createContext@https://billiar.info/jeux/conceptkids/index.js:9:119558 _emscripten_webgl_do_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189241 _emscripten_webgl_create_context@https://billiar.info/jeux/conceptkids/index.js:9:189380 .wasm-function[23471]@[wasm code] .wasm-function[15117]@[wasm code] .wasm-function[22487]@[wasm code] @https://billiar.info/jeux/conceptkids/index.js:9:326105 callMain@https://billiar.info/jeux/conceptkids/index.js:9:331025 @https://billiar.info/jeux/conceptkids/index.js:696:28 Promise@[native code] @https://billiar.info/jeux/conceptkids/index.js:691:25 null is not an object (evaluating 'gl.getContextAttributes().antialias') IMG_8373

This was really weird. I have 3.5.3 projects running fine even with iPhone 7. Do you have the specifications of the device? Are there anything that you suspect to be a culprit?

It is a iPhone 13 PRO and IOS 17.2 BETA public

SysError99 commented 10 months ago

@dragonal42 Although I found the culprit but it's completely fixable. Godot 3 with WebGL 2 is known to have a lot of issues and Godot 3 isn't the best at handling WebGL 2 on WebKit browsers. If you don't mind (judging by all elements you have on the game), you may switch the render to 1.0 version at the moment.

I know this is not a true solution at the long run (plus Godot 3 is likely to be dropped a support sooner or later depends on conditions), but for Godot 3 this is the best bet for you.

dragonal42 commented 10 months ago

@SysError99 thanks a lot .. but i can't find WebGL 1.0 parameter in godot 3.5.4, can you help me please ? my kids love my little games ! i think i will work on export them on ios app ...

Calinou commented 10 months ago

but i can't find WebGL 1.0 parameter in godot 3.5.4, can you help me please ?

Switch the project to use GLES2 in the top-right corner of the editor. GLES2 maps to WebGL 1.0, whereas GLES3 maps to WebGL 2.0.

dragonal42 commented 10 months ago

@Calinou Thanks ... but this version is also with this ... i will test to rebuild it

iryan2 commented 3 months ago

Is this the issue to track for Godot 4 support for exporting to web? I get this when exporting a very simple project to HTML5 and opening it in Edge on macOS 14.4.1:

image
AThousandShips commented 3 months ago

this the issue to track for Godot 4 support for exporting to web

It is not, this is a specific issue, and for 3.x, please ask questions about this here first (it is a configuration error it seems) and then open a new report if it's a bug

SysError99 commented 3 months ago

@iryan2 Make sure that you have satisfied the special requirements it said for Godot 4.x before jumping into the multitude of bugs that plague Apple-specific platforms. Making games with Godot 4.x for web is a mistake anyway.

Depending on what CDN or hosting platforms you use, you have to tap on those configurations. It can't be done in Godot game's file. It's by the design of the browser's specs and out of control of Godot unless the version 4.3 makes it working without multi-threading again.