Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when exporting in headless mode on Linux with Godot 4.2.2.rc2 #89674

Closed
hhyyrylainen opened this issue Mar 19, 2024 · 8 comments
Closed

Comments

@hhyyrylainen
Copy link

hhyyrylainen commented Mar 19, 2024

Tested versions

  • Reproducible in: v4.2.2.rc2.mono.official (c61a686) and I think also 4.2.1.stable and 4.2.2.rc1 (I was testing various things inside podman before finding the root cause but I didn't keep the various containers).
  • Update: also reproducible in non-mono version of Godot
  • Not reproducible: Godot 3.5 (I can't say anything more specifically as I'm porting my project to Godot 4 and haven't gotten a working version yet).

System information

Fedora 39, also happens inside a podman container with Fedora 39 base with minimal packages

Issue description

When exporting in headless mode I get a crash:

$ godot --export-release Linux/X11 build/BlankProject --headless
Godot Engine v4.2.2.rc2.mono.official.c61a68614 - https://godotengine.org
 
WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:505)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.2.rc2.mono.official (c61a68614e5b030a4a1e11abaa5a893b8017f78d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib64/dotnet/shared/Microsoft.NETCore.App/8.0.2/libcoreclr.so(+0x606a85) [0x7f866da06a85] (??:0)
[2] /usr/lib64/dotnet/shared/Microsoft.NETCore.App/8.0.2/libcoreclr.so(+0x6060b5) [0x7f866da060b5] (??:0)
[3] /lib64/libc.so.6(+0x3e9a0) [0x7f86931d39a0] (??:0)
[4] godot() [0x314a2a9] (??:0)
[5] godot() [0x31bab24] (??:0)
[6] godot() [0x31b5db7] (??:0)
[7] godot() [0x31b571f] (??:0)
[8] godot() [0x31bbdd4] (??:0)
[9] godot() [0x31bcff4] (??:0)
[10] godot() [0x31e852e] (??:0)
[11] godot() [0x2bef894] (??:0)
[12] godot() [0x172a448] (??:0)
[13] godot() [0x12edc3c] (??:0)
[14] godot() [0x4a70b7] (??:0)
[15] godot() [0x41e7f9] (??:0)
[16] /lib64/libc.so.6(+0x2814a) [0x7f86931bd14a] (??:0)
[17] /lib64/libc.so.6(__libc_start_main+0x8b) [0x7f86931bd20b] (??:0)
[18] godot() [0x42b24a] (??:0)
-- END OF BACKTRACE --
================================================================
Keskeytetty (luotiin core-tiedosto)

Running without the headless flag works:

$ godot --export-release Linux/X11 build/BlankProject
Godot Engine v4.2.2.rc2.mono.official.c61a68614 - https://godotengine.org
Vulkan API 1.3.267 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon RX 7900 XTX (RADV NAVI31)
 
savepack: begin: Pakataan steps: 102
	savepack: step 2: Varastoidaan Tiedostoa: res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex
	savepack: step 2: Varastoidaan Tiedostoa: res://icon.svg.import
	savepack: step 52: Varastoidaan Tiedostoa: res://.godot/exported/133200997/export-3070c538c03ee49b7677ff960a3f5195-main.scn
	savepack: step 102: Varastoidaan Tiedostoa: res://main.tscn.remap
	savepack: step 102: Varastoidaan Tiedostoa: res://.godot/global_script_class_cache.cfg
	savepack: step 102: Varastoidaan Tiedostoa: res://icon.svg
	savepack: step 102: Varastoidaan Tiedostoa: res://.godot/uid_cache.bin
	savepack: step 102: Varastoidaan Tiedostoa: res://project.binary
savepack: end
ERROR: Condition "!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting)" is true. Returning: Variant()
   at: _EDITOR_GET (editor/editor_settings.cpp:1144)

(though it prints this error: #84839)

When I export my full project, I get slightly different results, instead of SIGSEGV I get SIGILL:

Core was generated by `godot --editor --headless .'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x0000000000472607 in ?? ()
[Current thread is 1 (LWP 1563)]
(gdb) bt
#0  0x0000000000472607 in ?? ()
#1  0x0000000000000000 in ?? ()
Exporting to folder: builds/Thrive_0.6.6.0-alpha_linux_x11
libfontconfig.so.1: cannot open shared object file: No such file or directory
Godot Engine v4.2.2.rc2.mono.official.c61a68614 - https://godotengine.org
 
WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:505)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.2.rc2.mono.official (c61a68614e5b030a4a1e11abaa5a893b8017f78d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
ERROR: FATAL: Index p_index = 1 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:158)

Steps to reproduce

  • Open a basically new project (I just added one scene with a label and the default icon file in it to check that the exported project launches fine) in Godot
  • Try to export it with the --headless flag from terminal, observe it crashes
  • Export without the headless flag, this time it works (godot --export-release Linux/X11 build/BlankProject)

Minimal reproduction project (MRP)

BlankProject.zip

@raulsntos
Copy link
Member

I'm unable to reproduce this issue. I tested with 4.2.1.stable.mono.official (b09f793) and 4.2.2.rc2.mono.official (c61a686). To export I've used the command godot --export-release Linux/X11 build/BlankProject --headless on the provided MRP.

Can you reproduce this on non-mono versions of the editor? Also, your MRP doesn't contain a C# project but Thrive is a C# game, can you confirm that your issue also happens when the project doesn't contain C#?

@hhyyrylainen
Copy link
Author

I can confirm that trying to export that project still crashes for me (well I'm still using the 4.2.2 RC2 version, sorry if I missed a newer RC being available). So it does not require a C# project. I also just confirmed that v4.2.2.rc2.official.c61a68614 also crashes so it is not required to have the mono version of Godot to get this crash.

Here is a Dockerfile which reproduces the issue for me (and hopefully for everyone else as well):

FROM fedora:39

RUN dnf install -y --setopt=deltarpm=false unzip wget dotnet-sdk-8.0 fontconfig

ENV GODOT_VERSION "4.2.2-rc2"

RUN wget https://downloads.tuxfamily.org/godotengine/4.2.2/rc2/mono/Godot_v4.2.2-rc2_mono_linux_x86_64.zip \
    && wget https://downloads.tuxfamily.org/godotengine/4.2.2/rc2/mono/Godot_v4.2.2-rc2_mono_export_templates.tpz \
    && mkdir .p ~/.cache \
    && mkdir -p ~/.config/godot \
    && mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.rc2.mono \
    && unzip Godot_v${GODOT_VERSION}_mono_linux_x86_64.zip \
    && mv Godot_v${GODOT_VERSION}_mono_linux_x86_64 godot_dir \
    && mv godot_dir/* /usr/local/bin/ \
    && ln -s /usr/local/bin/Godot_v${GODOT_VERSION}_mono_linux.x86_64 /usr/local/bin/godot \
    && unzip Godot_v${GODOT_VERSION}_mono_export_templates.tpz \
    && mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.rc2.mono \
    && mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.rc2.mono/ \
    && rm -f Godot_v${GODOT_VERSION}_mono_export_templates.tpz Godot_v${GODOT_VERSION}_mono_linux_x86_64.zip \
    && rm -rf templates godot_dir

RUN mkdir /project

ADD export_presets.cfg icon.svg icon.svg.import main.tscn project.godot /project

RUN mkdir /project/build

# This is the export step which ends with a segfault
RUN cd /project && godot --export-release Linux/X11 build/BlankProject --headless

Putting that docker file in the sample project folder and running with podman ends with the following:

$ podman build BlankProject
# I cut out the long output from wget downloading stuff here
--> dcfa293def38
STEP 5/8: RUN mkdir /project
--> a0635cb09844
STEP 6/8: ADD export_presets.cfg icon.svg icon.svg.import main.tscn project.godot /project
--> f89e490cdf13
STEP 7/8: RUN mkdir /project/build
--> 7b3392ecbfa6
STEP 8/8: RUN cd /project && godot --export-release Linux/X11 build/BlankProject --headless
Godot Engine v4.2.2.rc2.mono.official.c61a68614 - https://godotengine.org
 
WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:505)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.2.rc2.mono.official (c61a68614e5b030a4a1e11abaa5a893b8017f78d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
ERROR: FATAL: Index p_index = 1 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:158)
container exited on illegal instruction
Error: building at STEP "RUN cd /project && godot --export-release Linux/X11 build/BlankProject --headless": while running runtime: exit status 1

Here's the updated sample project with the included Dockerfile: BlankProject2.zip

@hhyyrylainen hhyyrylainen changed the title Crash when exporting in headless mode on Linux with Godot 4.2.2.rc2.mono Crash when exporting in headless mode on Linux with Godot 4.2.2.rc2 Apr 5, 2024
@fire
Copy link
Member

fire commented Apr 9, 2024

See #90431

@akien-mga
Copy link
Member

Tested using the dockerfile above and podman on Fedora 39.

The dockerfile had some typos and installed the templates in the wrong folder, here's a fixed version with fully dehardcoded version numbers:

FROM fedora:39

RUN dnf install -y --setopt=deltarpm=false unzip wget dotnet-sdk-8.0 fontconfig

ENV GODOT_VERSION "4.2.2-rc2"

RUN wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_mono_linux_x86_64.zip \
    && wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_mono_export_templates.tpz \
    && mkdir .p ~/.cache \
    && mkdir -p ~/.config/godot \
    && mkdir -p ~/.local/share/godot/export_templates/${TEMPLATE_VERSION}.mono \
    && unzip Godot_v${GODOT_VERSION}_mono_linux_x86_64.zip \
    && mv Godot_v${GODOT_VERSION}_mono_linux_x86_64 godot_dir \
    && mv godot_dir/* /usr/local/bin/ \
    && ln -s /usr/local/bin/Godot_v${GODOT_VERSION}_mono_linux.x86_64 /usr/local/bin/godot \
    && unzip Godot_v${GODOT_VERSION}_mono_export_templates.tpz \
    && export TEMPLATE_VERSION=$(echo ${GODOT_VERSION} | sed -e "s/-/./") \
    && mkdir -p ~/.local/share/godot/export_templates/${TEMPLATE_VERSION}.mono \
    && mv templates/* ~/.local/share/godot/export_templates/${TEMPLATE_VERSION}.mono/ \
    && rm -f Godot_v${GODOT_VERSION}_mono_export_templates.tpz Godot_v${GODOT_VERSION}_mono_linux_x86_64.zip \
    && rm -rf templates godot_dir

RUN mkdir /project

ADD export_presets.cfg icon.svg icon.svg.import main.tscn project.godot /project

RUN mkdir /project/build

# This is the export step which ends with a segfault
RUN cd /project && godot --export-release Linux/X11 build/BlankProject --headless

I can reproduce the crash with 4.2.2-rc2 and 4.2.2-rc3.

It seems fixed in 4.3-dev5.

Would be good to figure out which commit fixed it in 4.3 so it could be cherry-picked for a future 4.2.x release. But otherwise the bug appears to be fixed.

@akien-mga
Copy link
Member

Would be good to figure out which commit fixed it in 4.3 so it could be cherry-picked for a future 4.2.x release. But otherwise the bug appears to be fixed.

Well I'll keep it open for now as reminder to try to find that commit.

@akien-mga akien-mga reopened this Apr 9, 2024
@akien-mga
Copy link
Member

akien-mga commented Apr 15, 2024

So I did some more testing, the bug is not reproducible in any 4.3 dev snapshot, nor 4.2-stable, 4.2.1-stable, or 4.2.2-rc1... but it's indeed present in 4.2.2-rc2, so it was a regression all along.

It's also still reproducible in 4.2.2-rc3, so that's a release blocker for 4.2.2-stable.

I also confirmed that the bug is not specific to the Mono build, it crashes the same with the standard build.

Trimmed down Dockerfile for that test:

FROM fedora:39

RUN dnf install -y --setopt=deltarpm=false unzip wget fontconfig

ENV GODOT_VERSION "4.2.2-rc3"

RUN wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip \
    && wget https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_export_templates.tpz \
    && mkdir .p ~/.cache \
    && mkdir -p ~/.config/godot \
    && mkdir -p ~/.local/share/godot/export_templates/${TEMPLATE_VERSION} \
    && unzip Godot_v${GODOT_VERSION}_linux.x86_64.zip \
    && mv Godot_v${GODOT_VERSION}_linux.x86_64 /usr/local/bin/ \
    && ln -s /usr/local/bin/Godot_v${GODOT_VERSION}_linux.x86_64 /usr/local/bin/godot \
    && unzip Godot_v${GODOT_VERSION}_export_templates.tpz \
    && export TEMPLATE_VERSION=$(echo ${GODOT_VERSION} | sed -e "s/-/./") \
    && mkdir -p ~/.local/share/godot/export_templates/${TEMPLATE_VERSION} \
    && mv templates/* ~/.local/share/godot/export_templates/${TEMPLATE_VERSION}/ \
    && rm -f Godot_v${GODOT_VERSION}_export_templates.tpz Godot_v${GODOT_VERSION}_linux_x86_64.zip \
    && rm -rf templates

RUN mkdir /project

ADD export_presets.cfg icon.svg icon.svg.import main.tscn project.godot /project

RUN mkdir /project/build

# This is the export step which ends with a segfault
RUN cd /project && godot --export-release Linux build/BlankProject --headless

@akien-mga akien-mga modified the milestones: 4.3, 4.2 Apr 15, 2024
@akien-mga
Copy link
Member

akien-mga commented Apr 15, 2024

Here's a backtrace:

Thread 1 "godot" received signal SIGBUS, Bus error.
0x00000000064429dd in ShaderCompiler::_get_sampler_name (this=0xb14b810, p_filter=185666464, p_repeat=ShaderLanguage::REPEAT_DISABLE) at ./servers/rendering/shader_compiler.cpp:300
300             return String(name_mapping[p_filter + (p_repeat == ShaderLanguage::REPEAT_ENABLE ? ShaderLanguage::FILTER_DEFAULT : 0)]);
(gdb) bt
#0  0x00000000064429dd in ShaderCompiler::_get_sampler_name (this=0xb14b810, p_filter=185666464, p_repeat=ShaderLanguage::REPEAT_DISABLE) at ./servers/rendering/shader_compiler.cpp:300
#1  0x000000000644a9f5 in ShaderCompiler::_dump_node_code (this=0xb14b810, p_node=0xb914e80, p_level=2, r_gen_code=..., p_actions=..., p_default_actions=..., p_assigning=false, p_use_scope=true)
    at ./servers/rendering/shader_compiler.cpp:1297
#2  0x0000000006447a50 in ShaderCompiler::_dump_node_code (this=0xb14b810, p_node=0xb9ba970, p_level=2, r_gen_code=..., p_actions=..., p_default_actions=..., p_assigning=false, p_use_scope=true)
    at ./servers/rendering/shader_compiler.cpp:857
#3  0x0000000006447387 in ShaderCompiler::_dump_node_code (this=0xb14b810, p_node=0xb9b51d0, p_level=2, r_gen_code=..., p_actions=..., p_default_actions=..., p_assigning=false, p_use_scope=true)
    at ./servers/rendering/shader_compiler.cpp:811
#4  0x0000000006446f5a in ShaderCompiler::_dump_node_code (this=0xb14b810, p_node=0x123fd250, p_level=1, r_gen_code=..., p_actions=..., p_default_actions=..., p_assigning=false, p_use_scope=true)
    at ./servers/rendering/shader_compiler.cpp:772
#5  0x000000000644dbbb in ShaderCompiler::compile (this=0xb14b810, p_mode=RenderingServer::SHADER_CANVAS_ITEM, p_code=..., p_actions=0x7fffffff7f00, p_path=..., r_gen_code=...)
    at ./servers/rendering/shader_compiler.cpp:1558
#6  0x0000000006578a72 in RendererDummy::MaterialStorage::shader_set_code (this=0xb14b7c8, p_shader=..., p_code=...) at servers/rendering/dummy/storage/material_storage.cpp:89
#7  0x00000000064a1af4 in RenderingServerDefault::shader_set_code (this=0xb101570, p1=..., p2=...) at ./servers/rendering/rendering_server_default.h:235
#8  0x0000000005b91d99 in Shader::set_code (this=0x1440a600, p_code=...) at ./scene/resources/shader.cpp:108
#9  0x00000000048e4fa7 in AnimationPlayerEditor::AnimationPlayerEditor (this=0x13b8df30, p_plugin=0x13b8d830) at ./editor/plugins/animation_player_editor_plugin.cpp:2026
#10 0x00000000048e67a7 in AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin (this=0x13b8d830) at ./editor/plugins/animation_player_editor_plugin.cpp:2196
#11 0x000000000431e79b in EditorNode::EditorNode (this=0xbc8e400) at ./editor/editor_node.cpp:7854
#12 0x00000000029f348e in Main::start () at main/main.cpp:3309
#13 0x0000000002964a79 in main (argc=5, argv=0x7fffffffd6a8) at platform/linuxbsd/godot_linuxbsd.cpp:72

This points at #87392 likely causing the regression. It works in 4.3, but evidently this wasn't applicable as is to 4.2.x.

CC @clayjohn

Edit: Confirmed that reverting 5f92e6e fixes it.

@akien-mga
Copy link
Member

Fixed by #90738.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants