godotengine / godot

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

Editor fails to launch on Linux without any error when project is on a path with `\x20` #80387

Open acook opened 1 year ago

acook commented 1 year ago

Godot version

v4.1.1.stable.official [bd6af8e0e]

System information

Linux 6.4.8-247.current

Issue description

The editor fails to open projects.

So I assume there is some missing library or something on my system. But there is no info on the commandline and no error messages or feedback. Just silently takes me back to the Project Manager window.

I ran Delta V: Rings of Saturn to confirm that a built Godot game would work, and it ran just fine. As do non-Godot games from Stellaris for Linux from GoG to Deep Rock Galactic running on Proton.

Very perplexing.

Screenshot from 2023-08-07 11-40-40 Screenshot from 2023-08-07 11-40-59

Steps to reproduce

  1. Run Godot
  2. Create a new project
  3. Click on project to highlight it
  4. Click Edit button

Expected

Godot editor launches.

Actual

Godot logo displays briefly before returning to the Project Manager.

Minimal reproduction project

Empty projected I tested with: Aleph.zip

Also tried a demo project from the asset list and got the same result.

qza2468 commented 1 year ago

Yep, have this problem in godot v4.0.3.stable.official [5222a99f5], Ubuntu 22.04 too. After I click the edit btn, one of my screen will totally stuck(i have two screen), need replug hdmi to recover. :)

rsubtil commented 1 year ago

Can you try running Godot from a terminal, and directly open the project? $ ./Godot_v4.1.1-stable_linux.x86_64 -e path/to/project

If it still doesn't print any useful info, try running with -v (verbose mode) to get more info.

Also, how did you install Godot on your system?

Calinou commented 1 year ago

Are you using a X11 or Wayland session? Use echo $XDG_SESSION_TYPE in a terminal to know. (Wayland on NVIDIA is notoriously buggy, so use a X11 session instead.)

acook commented 1 year ago

This is X11 with Budgie.

Trying to open a project from the commandline doesn't seem to dump anything interesting either.

❯ clear ; ./Godot_v4.1.1-stable_linux.x86_64 -v -e /media/data.secondary/Game\ Projects/Godot/Aleph/project.godot
Godot Engine v4.1.1.stable.official.bd6af8e0e - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
Xshape 1.1 detected.
Xinerama 1.1 detected.
Xrandr 1.6 detected.
Xrender 0.11 detected.
Xinput 2.2 detected.
XInput: Refreshing devices.
XInput: No touch devices found.
Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.
Only one GPU found, using default.
ScreenSaver: DBus 1.14.4 detected.
PortalDesktop: DBus 1.14.4 detected.
Using "default" pen tablet driver...
Shader 'CanvasSdfShaderGLES3' SHA256: 72cda41890bce2f09217c172023d31e735a3fee605bad83c8e63f1a981a36a77
Shader 'SkeletonShaderGLES3' SHA256: add3f03e6eebdffdf0073fae42195857307eddada333b82998642329511917a2
Shader 'ParticlesShaderGLES3' SHA256: 9bf432d37b0b4792d67aa9f577258845d4047e3f98e990aeca6fd20a868c4db2
Shader 'ParticlesCopyShaderGLES3' SHA256: c778843b0cd1c7ce4c621fa2b924f703ac4001faef0555114b81a76c264a6908
Shader 'CopyShaderGLES3' SHA256: b1bc5a355ed9bda23f291956f121e0535b4e81b54cdac398412d200e6133161f
Shader 'CanvasShaderGLES3' SHA256: 007cddfcf35f7d57b219cffec53f6a7d9fe7a1979be4db64c6450cfac6000053
Shader 'CanvasOcclusionShaderGLES3' SHA256: 968915a469db9a7d505be274e8060c8288c15a5865baeb8362b3b0e2cacb16f3
Shader 'SceneShaderGLES3' SHA256: 7757391c487ac94cfa6418166bd5fdacce470f09394c1a2a875e878c8c5d8596
Shader 'SkyShaderGLES3' SHA256: 1fe105946e63973aecf5198091930c2bdb17778012ef0253e325ade3a297e6c8
Shader 'CubemapFilterShaderGLES3' SHA256: 2b651c285a02b7d4221af1827e1613c03e73e600ebc40b9e6a0b22bb855bd75f
OpenGL API 3.3.0 NVIDIA 535.86.05 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3080 Ti
JoypadLinux: udev enabled and loaded successfully.
PulseAudio 15.0.0 detected.
PulseAudio: context other
PulseAudio: context other
PulseAudio: context other
PulseAudio: context ready
PulseAudio: Detecting channels for device: alsa_output.pci-0000_0a_00.1.hdmi-stereo-extra1
PulseAudio: detected 2 output channels
PulseAudio: audio buffer frames: 512 calculated output latency: 11ms

TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)".
CORE API HASH: 3144975361
EDITOR API HASH: 3555714656
EditorSettings: Load OK!
Loaded system CA certificates
EditorSettings: Save OK!

Godot was downloaded from the official website and moved to a writable subdirectory in /opt.

Calinou commented 1 year ago

Can you reproduce this with a new project if you create it with the Compatibility rendering method? Forward+ and Mobile use Vulkan, and your Vulkan driver setup may be broken (e.g. due to bogus Vulkan layers).

You can also try to force Vulkan for the project manager using --rendering-driver vulkan.

acook commented 1 year ago

Thanks, worth a shot.

I tested with a new "compatibility" renderer project and also disabled git too for fun.

Same behaviour.

I ran Godot with --rendering-driver vulkan and the Project Manager works just fine, but still can't edit anything.

I am able to play Vulkan games just fine. Plus Proton/WINE uses Vulkan for translating D3D commands. As mentioned, I fired up several different games, made both in Godot and other engines.

So it looks like the Vulkan theory is probably be busted.

Is there some kind of debug build of Godot I could try that might be more verbose? I could build it from scratch locally and see if anything changes?

rsubtil commented 1 year ago

Is there some kind of debug build of Godot I could try that might be more verbose? I could build it from scratch locally and see if anything changes?

There's Calinou's debug builds, but the latest one available is v4.0.3, not sure if there's another pre-compiled source. But if you're up for compilling yourself, here's the official guide

acook commented 1 year ago

Built Godot v4.2.dev.custom_build.f7bc653cb using scons platform=linuxbsd udev=yes lto=full.

Same behaviour unfortunately.

Screenshot from 2023-08-09 04-41-25

Built Godot Debug Build v4.0.3.stable.custom_build.5222a99f5 with ./build_linux.sh

Running verbose with ./bin/linux/godot.linuxbsd.editor.x86_64 -v doesn't give any more info really. Pretty sure I saw the same string errors for key names.

Editing project: /media/data.secondary/Game Projects/Godot/Dalet
Godot Engine v4.0.3.stable.custom_build.5222a99f5 - https://godotengine.org
EditorSettings: Save OK!
XR: Clearing primary interface
XR: Removed interfaceNative mobile
XR: Removed interfaceOpenXR
PulseAudio: context terminated
Orphan StringName: OP_MODULE
Orphan StringName: KEY_SYSREQ
Orphan StringName: PROPERTY_HINT_NONE
...
Orphan StringName: PROPERTY_HINT_PLACEHOLDER_TEXT
StringName: 550 unclaimed string names at exit.

When I ran the debug build with gdb and run ./bin/linux/godot.linuxbsd.editor.x86_64 then tried to launch the editor I got this:

[Detaching after fork from child process 184211]
Godot Engine v4.0.3.stable.custom_build.5222a99f5 - https://godotengine.org
[Thread 0x7fffbf29b6c0 (LWP 184208) exited]
[Thread 0x7fffbfc9c6c0 (LWP 184207) exited]
[Thread 0x7fffc8a006c0 (LWP 184206) exited]
[Thread 0x7fffc92016c0 (LWP 184205) exited]
[Thread 0x7fffd08ba6c0 (LWP 184204) exited]
[Thread 0x7fffd882a6c0 (LWP 184202) exited]
[Thread 0x7fffe45f46c0 (LWP 184178) exited]
[Thread 0x7fffdede96c0 (LWP 184189) exited]
[Thread 0x7fffdc5e46c0 (LWP 184194) exited]
[Thread 0x7fffd9ddf6c0 (LWP 184199) exited]
[Thread 0x7fffda5e06c0 (LWP 184198) exited]
[Thread 0x7fffdade16c0 (LWP 184197) exited]
[Thread 0x7fffdb5e26c0 (LWP 184196) exited]
[Thread 0x7fffdbde36c0 (LWP 184195) exited]
[Thread 0x7fffdcde56c0 (LWP 184193) exited]
[Thread 0x7fffdd5e66c0 (LWP 184192) exited]
[Thread 0x7fffddde76c0 (LWP 184191) exited]
[Thread 0x7fffde5e86c0 (LWP 184190) exited]
[Thread 0x7fffdf5ea6c0 (LWP 184188) exited]
[Thread 0x7fffdfdeb6c0 (LWP 184187) exited]
[Thread 0x7fffe05ec6c0 (LWP 184186) exited]
[Thread 0x7fffe0ded6c0 (LWP 184185) exited]
[Thread 0x7fffe15ee6c0 (LWP 184184) exited]
[Thread 0x7fffe1def6c0 (LWP 184183) exited]
[Thread 0x7fffe25f06c0 (LWP 184182) exited]
[Thread 0x7fffe2df16c0 (LWP 184181) exited]
[Thread 0x7fffe35f26c0 (LWP 184180) exited]
[Thread 0x7fffe3df36c0 (LWP 184179) exited]
[Thread 0x7fffe4df56c0 (LWP 184177) exited]
[Thread 0x7fffe55f66c0 (LWP 184176) exited]
[Thread 0x7fffe5df76c0 (LWP 184175) exited]
[Thread 0x7fffe65f86c0 (LWP 184174) exited]
[Thread 0x7fffe6df96c0 (LWP 184173) exited]
[Thread 0x7fffe75fa6c0 (LWP 184172) exited]
[Thread 0x7fffe7dfb6c0 (LWP 184171) exited]
[Thread 0x7fffe85fc6c0 (LWP 184170) exited]
[Thread 0x7fffe8dfd6c0 (LWP 184169) exited]
[Thread 0x7fffe95fe6c0 (LWP 184168) exited]
[Thread 0x7fffe9dff6c0 (LWP 184167) exited]
[Inferior 1 (process 184162) exited normally]
-----------------------------------------------------------------------------------------------------------------------[regs]
  RAX:Error while running hook_stop:
No registers.
gdb$ OpenGL API 3.3.0 NVIDIA 535.86.05 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce RTX 3080 Ti

Which is funny. Everything seems to agree that the editor exiting is very normal and not at all a problem. Even though it clearly is.

rsubtil commented 1 year ago

When running under gdb, launch the project directly with the --path flag, because the editor process forks when launching a project.

Can you try that, let it run for a while, then stop execution and get a backtrace? (> bt) It looks like the editor is getting stuck somewhere.

acook commented 1 year ago

It immediately drops me into the Project Manager whether I run it from gdb or not.

❯ gdb --args ./linux/godot.linuxbsd.editor.x86_64 -e --path /media/data.secondary/Game\ Projects/Godot/Dalet/
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-solus-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Warning: 'set logging on', an alias for the command 'set logging enabled', is deprecated.
Use 'set logging enabled on'.

Warning: 'set logging off', an alias for the command 'set logging enabled', is deprecated.
Use 'set logging enabled off'.

Reading symbols from ./linux/godot.linuxbsd.editor.x86_64...
gdb$ run
Starting program: ~/Source/Clones/godot-debug-builds/bin/linux/godot.linuxbsd.editor.x86_64 -e --path /media/data.secondary/Game\ Projects/Godot/Dalet/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
[Detaching after vfork from child process 201279]
[New Thread 0x7fffe9dff6c0 (LWP 201281)]
[New Thread 0x7fffe95fe6c0 (LWP 201282)]
[New Thread 0x7fffe8dfd6c0 (LWP 201283)]
[New Thread 0x7fffe85fc6c0 (LWP 201284)]
[New Thread 0x7fffe7dfb6c0 (LWP 201285)]
[New Thread 0x7fffe75fa6c0 (LWP 201286)]
[New Thread 0x7fffe6df96c0 (LWP 201287)]
[New Thread 0x7fffe65f86c0 (LWP 201288)]
[New Thread 0x7fffe5df76c0 (LWP 201289)]
[New Thread 0x7fffe55f66c0 (LWP 201290)]
[New Thread 0x7fffe4df56c0 (LWP 201291)]
[New Thread 0x7fffe45f46c0 (LWP 201292)]
[New Thread 0x7fffe3df36c0 (LWP 201293)]
[New Thread 0x7fffe35f26c0 (LWP 201294)]
[New Thread 0x7fffe2df16c0 (LWP 201295)]
[New Thread 0x7fffe25f06c0 (LWP 201296)]
[New Thread 0x7fffe1def6c0 (LWP 201297)]
[New Thread 0x7fffe15ee6c0 (LWP 201298)]
[New Thread 0x7fffe0ded6c0 (LWP 201299)]
[New Thread 0x7fffe05ec6c0 (LWP 201300)]
[New Thread 0x7fffdfdeb6c0 (LWP 201301)]
[New Thread 0x7fffdf5ea6c0 (LWP 201302)]
[New Thread 0x7fffdede96c0 (LWP 201303)]
[New Thread 0x7fffde5e86c0 (LWP 201304)]
[New Thread 0x7fffddde76c0 (LWP 201305)]
[New Thread 0x7fffdd5e66c0 (LWP 201306)]
[New Thread 0x7fffdcde56c0 (LWP 201307)]
[New Thread 0x7fffdc5e46c0 (LWP 201308)]
[New Thread 0x7fffdbde36c0 (LWP 201309)]
[New Thread 0x7fffdb5e26c0 (LWP 201310)]
[New Thread 0x7fffdade16c0 (LWP 201311)]
[New Thread 0x7fffda5e06c0 (LWP 201312)]
[New Thread 0x7fffd9ddf6c0 (LWP 201313)]
Godot Engine v4.0.3.stable.custom_build.5222a99f5 - https://godotengine.org
[New Thread 0x7fffd8fa46c0 (LWP 201314)]
[Detaching after fork from child process 201315]
[New Thread 0x7fffd3fff6c0 (LWP 201316)]
[Thread 0x7fffd8fa46c0 (LWP 201314) exited]
[Detaching after fork from child process 201317]
[New Thread 0x7fffc95ff6c0 (LWP 201318)]
OpenGL API 3.3.0 NVIDIA 535.86.05 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce RTX 3080 Ti
[New Thread 0x7fffc8dfe6c0 (LWP 201319)]
[New Thread 0x7fffc85fd6c0 (LWP 201320)]
[New Thread 0x7fffc7c516c0 (LWP 201321)]

[New Thread 0x7fffc72506c0 (LWP 201322)]

Because it immediately kicks over the Project Manager I don't think that a trace will be very useful but here is the bt command after I halted it:

^C
Thread 1 "godot.linuxbsd." received signal SIGINT, Interrupt.
-----------------------------------------------------------------------------------------------------------------------[regs]
  RAX: 0xFFFFFFFFFFFFFDFC  RBX: 0x00007FFFFFFFDDA0  RCX: 0x00007FFFF7CDD835  RDX: 0x00007FFFFFFFDDA0  o d I t S z A p C
  RSI: 0x0000000000000000  RDI: 0x0000000000000000  RBP: 0x00007FFFFFFFDDB0  RSP: 0x00007FFFFFFFDD60  RIP: 0x00007FFFF7CDD835
  R8 : 0x0000000000000000  R9 : 0x0000000000000004  R10: 0x00007FFFFFFFDDB0  R11: 0x0000000000000293  R12: 0x0000000000000000
  R13: 0x0000000000000000  R14: 0x0000000000000045  R15: 0x0000000000000000
  CS: 0033  DS: 0000  ES: 0000  FS: 0000  GS: 0000  SS: 002B
-----------------------------------------------------------------------------------------------------------------------[code]
=> 0x7ffff7cdd835 <clock_nanosleep+101>:        mov    edi,r8d
   0x7ffff7cdd838 <clock_nanosleep+104>:        mov    QWORD PTR [rsp],rax
   0x7ffff7cdd83c <clock_nanosleep+108>:        call   0x7ffff7c8bc40
   0x7ffff7cdd841 <clock_nanosleep+113>:        mov    rax,QWORD PTR [rsp]
   0x7ffff7cdd845 <clock_nanosleep+117>:        add    rsp,0x28
   0x7ffff7cdd849 <clock_nanosleep+121>:        neg    eax
   0x7ffff7cdd84b <clock_nanosleep+123>:        ret
   0x7ffff7cdd84c <clock_nanosleep+124>:        nop    DWORD PTR [rax+0x0]
-----------------------------------------------------------------------------------------------------------------------------
0x00007ffff7cdd835 in clock_nanosleep () from /usr/lib/haswell/libc.so.6
gdb$ bt
#0  0x00007ffff7cdd835 in clock_nanosleep () from /usr/lib/haswell/libc.so.6
#1  0x00007ffff7ce23c7 in nanosleep () from /usr/lib/haswell/libc.so.6
#2  0x000055555717b0f8 in OS_Unix::delay_usec (this=<optimized out>, p_usec=<optimized out>) at drivers/unix/os_unix.cpp:256
#3  0x000055555a29bcbf in OS::add_frame_delay (this=this@entry=0x7fffffffdf20, p_can_draw=<optimized out>) at core/os/os.cpp:548
#4  0x000055555610b6fc in Main::iteration () at main/main.cpp:3251
#5  0x00005555560a5ba1 in OS_LinuxBSD::run (this=this@entry=0x7fffffffdf20) at platform/linuxbsd/os_linuxbsd.cpp:889
#6  0x00005555560961f1 in main (argc=<optimized out>, argv=0x7fffffffe478) at platform/linuxbsd/godot_linuxbsd.cpp:73

Is there a good place in the editor code where I could drop a breakpoint or something?

akien-mga commented 1 year ago

I wonder if the dot in /media/data.secondary/Game\ Projects/Godot/Dalet/ is not causing issues.

Could you try running a project from a different path, such as your $HOME?

acook commented 1 year ago

I think you're onto something.

I've tried many other locations and other names. In my home folder it works with spaces or periods - so it isn't the dots. It also works on my external drive - so it isn't because it is across some odd filesystem boundary.

But the editor will not work on my secondary internal drive no matter where it is.

And after making many different projects and trying things out I think I know why:

  1. The standard path I use to access my secondary drive, as you've seen, is /media/data.secondary
  2. But that path is actually a symlink to another path in /mnt (for historical reasons)
  3. The partition's label has a space in it, and that label is used as the name of the folder
  4. Due to some weird bug, the mount configuration system choked on the space and rendered it as \x20

Godot's Project Manager can access the symlink, but I tried to brown to the path with the backslash in it, and it refuses to open the path at all. I can select it, but then the Godot Project Manager reports that the path specified doesn't exist.

Screenshot from 2023-08-09 08-18-21

You'll also note that it shows a forward slash instead of the backslash that it should.

Screenshot from 2023-08-09 08-30-23

Nemo, my file manager, displays the disk label in the breadcrumbs, but the backslashed version generated by the mounting configuration in the folder itself.

So I think that the editor is trying to resolve symlinks, hits that backslash and decides that it has seen enough and exits.

Incidentally, Godot does not crash or report any errors to the console when it is unable to open that weird path in the project browser.

I haven't run into any other programs that have issues with it, but I can kinda understand why a program might. I can do a workaround to rename the mount path, and since I luckily used a symlink for everything, very few things should break so long as I update the /media/data.secondary link. I'll try that out shortly.

acook commented 1 year ago

Can confirm:

Now works!

Screenshot from 2023-08-09 08-40-24

So it had to do with the backslash in the symlink path.

akien-mga commented 1 year ago

Could you copy how ls -l renders that mount point name in ls -l /mnt? (you can remove other mountpoints which aren't relevant)

IIUC the folder is actually named /mnt/Construct\x20Data? I.e. the space is encoded as \x20 instead of being a regular space.

This likely gets read as /mnt/Construct\\x20Data to escape the escape... and Godot converts \\ to / to support Windows path style.

So indeed renaming this mount point would solve the issue. Godot can maybe be tweaked to support this though I admit it's the first time I see such a path on Unix...

rsubtil commented 1 year ago

Indeed, seems like Godot cannot open (at least on Linux) paths with a backlash. I've just moved an empty project to a Projects/godot\folder, and now Godot fails to find that path.

akien-mga commented 1 year ago

We could change the replace("\\", "/") to run it only on Windows, but this might have other unwanted consequences. Needs thorough testing.

acook commented 1 year ago

I removed it as part of changing the mount point, but from the terminal it would display as 'Construct\x20Data' in single quotes instead of double backslash.

Screenshot from 2023-08-09 09-01-57

You can reproduce it trivially like I did above with:

mkdir 'Foo\x20Bar'
ln -s 'Foo\x20Bar' foobar

Then create a new project at foobar.

If you try to browse into Foo\x20Bar directly, the Project Manager will stay in the parent directory and do nothing at all. If you add that directory it will replace the backslash with forward slash.

acook commented 1 year ago

Looks like that incantation is used all over the place. I might suggest a single Path object which can handle paths instead of disconnected bespoke string operations.

Screenshot from 2023-08-09 09-09-02

There is a single file (but not exactly tiny) library called cwalk for C/C++ which could be handy if you don't want to write your own. It is also MIT licensed like Godot.

I've written my own Path libraries in a couple of languages, but not C++. I could give it a shot if you're interested.