godotengine / godot

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

Wayland: Editor crashes trying to load any project. #88113

Open jcarlosrc opened 7 months ago

jcarlosrc commented 7 months ago

Tested versions

System information

Ubuntu 22.04.3 LTS using Wayland.

Issue description

If configured to use Wayland, the editor crashes when trying to load any project. It works as usual when using x11. The console output is:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.dev3.official (36e943b6b20cb7a8a89bc30489c4a81c3e149d74)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fb750c42520] (??:0)
[2] /lib64/ld-linux-x86-64.so.2(+0x324d) [0x7fb750f8e24d] (??:0)
[3] /lib/x86_64-linux-gnu/libc.so.6(_dl_catch_exception+0x88) [0x7fb750d74a98] (??:0)
[4] /lib/x86_64-linux-gnu/libc.so.6(_dl_catch_error+0x33) [0x7fb750d74b63] (??:0)
[5] /lib/x86_64-linux-gnu/libc.so.6(+0x9012e) [0x7fb750c9012e] (??:0)
[6] /lib/x86_64-linux-gnu/libc.so.6(dlclose+0x28) [0x7fb750c8fe58] (??:0)
[7] /lib/x86_64-linux-gnu/libnvidia-vulkan-producer.so(ProducerCleanup+0x4d) [0x7fb724c01e0d] (??:0)
[8] /lib/x86_64-linux-gnu/libnvidia-vulkan-producer.so(ProducerInit+0x2bb) [0x7fb724c020db] (??:0)
[9] /lib/x86_64-linux-gnu/libnvidia-glcore.so.535.154.05(+0x1819db2) [0x7fb72ba19db2] (??:0)
[10] /lib/x86_64-linux-gnu/libnvidia-glcore.so.535.154.05(+0x18440ff) [0x7fb72ba440ff] (??:0)
[11] /lib/x86_64-linux-gnu/libnvidia-glcore.so.535.154.05(+0x186811d) [0x7fb72ba6811d] (??:0)
[12] /lib/x86_64-linux-gnu/libGLX_nvidia.so.0(+0x9cb50) [0x7fb748161b50] (??:0)
[13] /lib/x86_64-linux-gnu/libvulkan.so.1(+0x34c4e) [0x7fb74875ac4e] (??:0)
[14] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x1035e41] (??:0)
[15] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x103cd99] (??:0)
[16] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x432dac] (??:0)
[17] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x47f1a6] (??:0)
[18] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x4ada19] (??:0)
[19] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x4af152] (??:0)
[20] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x407ee7d] (??:0)
[21] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x50d447] (??:0)
[22] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x4077924] (??:0)
[23] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x41fc5b] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fb750c29d90] (??:0)
[25] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fb750c29e40] (??:0)
[26] /home/jcarlos/Godot/Godot_v4.3-dev3_linux.x86_64() [0x42be2a] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

Launch Godot with the --display-driver wayland option. Create a new project and try to load it.

Minimal reproduction project (MRP)

N/A

akien-mga commented 7 months ago

Thanks for the report.

Could you give a bit more detail on the exact command you run to start Godot, and how you then load the project?

If you run Godot with Godot_v4.3-dev3_linux.x86_64 --display-driver wayland, it should indeed run the project manager with Wayland. But then opening a project from the project manager would actually start an X11/xwayland process, unless you enabled the option to prefer Wayland in the editor (yes it's quirky, we'll improve that eventually).

So it's important to figure out if it's actually trying to open the editor with X11 or Wayland when it crashes.

The stacktrace is also a bit weird as it involves both the OpenGL and Vulkan drivers for your Nvidia GPU. If you're able to compile Godot from source, you could try to compiling with scons dev_build=yes to ensure that you'll get debug symbols, which should give us a better stacktrace.

causecause1 commented 7 months ago

This had been happening to me for a few months until a day or two ago, though I'm using Kubuntu 23.10 and it only started happening when I switched to it. What seems to have fixed it is the most recent kernel update, at least I haven't seen it since then.

This bug also affected my custom engine (OpenGL) application as well, and in both cases, my whole PC sometimes ended up freezing up. The screen would switch on and off and usually, if I waited long enough, KDE would kind of crash but still be somewhat active (enough that I could either restart the device the normal way or restart Kwin through the terminal). But yeah, sometimes it would completely freeze up.

And it wasn't even Nvidia, but an AMD APU (Ryzen 5500U).

jcarlosrc commented 7 months ago

Thanks for the report.

Could you give a bit more detail on the exact command you run to start Godot, and how you then load the project?

If you run Godot with Godot_v4.3-dev3_linux.x86_64 --display-driver wayland, it should indeed run the project manager with Wayland. But then opening a project from the project manager would actually start an X11/xwayland process, unless you enabled the option to prefer Wayland in the editor (yes it's quirky, we'll improve that eventually).

So it's important to figure out if it's actually trying to open the editor with X11 or Wayland when it crashes.

The stacktrace is also a bit weird as it involves both the OpenGL and Vulkan drivers for your Nvidia GPU. If you're able to compile Godot from source, you could try to compiling with scons dev_build=yes to ensure that you'll get debug symbols, which should give us a better stacktrace.

Well, I have tested further and observed that:

Riteo commented 6 months ago

What's your GPU and driver version?

Judging from the stack trace you're probably using a card from NVIDIA. Their drivers are notoriously broken, especially when it comes to Wayland support in older versions (the situation is slowly improving).

I see that you're using an LTS version of Ubuntu, so that might be it. I would try to reproduce this issue on a more bleeding-edge distro with the latest everything.

izzyn commented 4 months ago

I see that you're using an LTS version of Ubuntu, so that might be it. I would try to reproduce this issue on a more bleeding-edge distro with the latest everything.

Tried on an updated version of arch, opened the project both from the command line directly and through setting the wayland preference flag in the editor settings, got the follow error with both attempts:

ERROR: Condition "err != VK_SUCCESS" is true. Returning: ERR_CANT_CREATE
   at: swap_chain_resize (drivers/vulkan/rendering_device_driver_vulkan.cpp:2665)
ERROR: Unable to resize the new swap chain.
   at: screen_create (servers/rendering/rendering_device.cpp:3157)
ERROR: Screen was never prepared.
   at: screen_get_framebuffer_format (servers/rendering/rendering_device.cpp:3226)
ERROR: Screen was never prepared.
   at: screen_get_framebuffer_format (servers/rendering/rendering_device.cpp:3226)
ERROR: Screen was never prepared.
   at: screen_get_framebuffer_format (servers/rendering/rendering_device.cpp:3226)
ERROR: Screen was never prepared.
   at: screen_get_framebuffer_format (servers/rendering/rendering_device.cpp:3226)

ERROR: A swap chain was not created for the screen.
   at: screen_prepare_for_drawing (servers/rendering/rendering_device.cpp:3168)
ERROR: Screen was never prepared.
   at: draw_list_begin_for_screen (servers/rendering/rendering_device.cpp:3272)
ERROR: Parameter "dl" is null.
   at: draw_list_bind_render_pipeline (servers/rendering/rendering_device.cpp:3538)
ERROR: Parameter "dl" is null.
   at: draw_list_bind_index_array (servers/rendering/rendering_device.cpp:3690)
ERROR: Parameter "dl" is null.
   at: draw_list_bind_uniform_set (servers/rendering/rendering_device.cpp:3625)
ERROR: Parameter "dl" is null.
   at: draw_list_set_push_constant (servers/rendering/rendering_device.cpp:3728)
ERROR: Parameter "dl" is null.
   at: draw_list_draw (servers/rendering/rendering_device.cpp:3748)
ERROR: Immediate draw list is already inactive.
   at: draw_list_end (servers/rendering/rendering_device.cpp:3943)
ERROR: A swap chain was not created for the screen.
   at: screen_prepare_for_drawing (servers/rendering/rendering_device.cpp:3168)

System Information

OS: EndevourOS x86_64 Kernel: 6.8.5-arch1-1 GPU: NVIDIA MX450 (and integrated intel)

Riteo commented 4 months ago

@Spizzy1 judging from the log, it really looks like a driver bug, I'm sorry :/

The only error written there is pretty much a vulkan-related one.

Does the vkcube-wayland program work? You might need to install it if you haven't already, but I can't recommend you a package as it changes between distros AFAIK.

Could you also try the compatibility graphics backend (OpenGL)?

Riteo commented 1 month ago

Oops, sorry for the ping, the PR above does not fix the issue here, sorry.

SeeStarz commented 3 weeks ago

Same issue. Project loader works fine, except there's some warnings about DRI_PRIME. Always crashes when opening editor. Does not happen when simply loading up the scene (because it runs X11?).

Also, i can open the editor when i create a new project (from scratch), but opening existing project won't work.

godot-git from aur

ERROR: None of the devices supports both graphics and present queues.
   at: initialize (servers/rendering/rendering_device.cpp:5365)
ERROR: FATAL: Index p_index = 0 is out of bounds (count = 0).
   at: operator[] (./core/templates/local_vector.h:177)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.4.dev.custom_build (1bd740d18d714f815486b04bf4c6154ef6c355d9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3d1d0) [0x7f5ccf96d1d0] (??:0)
[2] /usr/bin/godot(+0x3e01a6f) [0x5805da58aa6f] (??:0)
[3] /usr/bin/godot(+0x3e64110) [0x5805da5ed110] (??:0)
[4] /usr/bin/godot(+0x3e69cae) [0x5805da5f2cae] (??:0)
[5] /usr/bin/godot(+0x630808) [0x5805d6db9808] (??:0)
[6] /usr/bin/godot(+0x68263d) [0x5805d6e0b63d] (??:0)
[7] /usr/bin/godot(+0x683b7e) [0x5805d6e0cb7e] (??:0)
[8] /usr/bin/godot(+0x4e93072) [0x5805db61c072] (??:0)
[9] /usr/bin/godot(+0x4f2e8fb) [0x5805db6b78fb] (??:0)
[10] /usr/bin/godot(+0x4f4642f) [0x5805db6cf42f] (??:0)
[11] /usr/bin/godot(+0x5c3221) [0x5805d6d4c221] (??:0)
[12] /usr/lib/libc.so.6(+0x25e08) [0x7f5ccf955e08] (??:0)
[13] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7f5ccf955ecc] (??:0)
[14] /usr/bin/godot(+0x5e31e5) [0x5805d6d6c1e5] (??:0)
-- END OF BACKTRACE --
================================================================

godot 4.3-1 from arch extra repository

ERROR: None of the devices supports both graphics and present queues.
   at: initialize (servers/rendering/rendering_device.cpp:5359)
ERROR: FATAL: Index p_index = 0 is out of bounds (count = 0).
   at: operator[] (./core/templates/local_vector.h:177)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.3.stable.arch_linux
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3d1d0) [0x7e1c7da4c1d0] (??:0)
[2] /usr/bin/godot(+0x3eafa4f) [0x5f398d6c2a4f] (??:?)
[3] /usr/bin/godot(+0x3df3932) [0x5f398d606932] (??:?)
[4] /usr/bin/godot(+0x3df61de) [0x5f398d6091de] (??:?)
[5] /usr/bin/godot(+0x67ff08) [0x5f3989e92f08] (??:?)
[6] /usr/bin/godot(+0x6ca769) [0x5f3989edd769] (??:?)
[7] /usr/bin/godot(+0x6cc1de) [0x5f3989edf1de] (??:?)
[8] /usr/bin/godot(+0x4ce0fb2) [0x5f398e4f3fb2] (??:?)
[9] /usr/bin/godot(+0x4d72ab7) [0x5f398e585ab7] (??:?)
[10] /usr/bin/godot(+0x4d8439c) [0x5f398e59739c] (??:?)
[11] /usr/bin/godot(+0x614361) [0x5f3989e27361] (??:?)
[12] /usr/lib/libc.so.6(+0x25e08) [0x7e1c7da34e08] (??:0)
[13] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7e1c7da34ecc] (??:0)
[14] /usr/bin/godot(+0x6332c5) [0x5f3989e462c5] (??:?)
-- END OF BACKTRACE --
================================================================

System Information

OS: Arch Linux x86_64 Kernel: 6.10.5-arch1-1 GPU: RTX 3050 Mobile and Radeon Vega Mobile (integrated) Driver version: nvidia 555.58.02-16