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

[4.4] Font importing (.ttf) gets stuck when trying to export with Godot #103696

Open
hhyyrylainen opened this issue Mar 6, 2025 · 5 comments · May be fixed by #104013
Open

[4.4] Font importing (.ttf) gets stuck when trying to export with Godot #103696

hhyyrylainen opened this issue Mar 6, 2025 · 5 comments · May be fixed by #104013

Comments

@hhyyrylainen
Copy link

Tested versions

  • Reproducible in: v4.4.stable.mono.official.4c311cbee
  • Not reproducible in: 4.3

System information

Fedora 41 podman container, also on Fedora 41 GNOME desktop

Issue description

There seems to be a new bug in Godot 4.4 where my game export process inside a container just hangs indefinitely when it tries to import some .ttf font files (I've left it be for over an hour with no new terminal output). I kept deleting the files as the process got stuck and after about 10 I stopped testing so I think this isn't specific to any font file (unless all NotoSans family fonts have the issue).

If I delete all of the .ttf font files before running --export-release then that makes the problem go away (i.e. the export process doesn't get stuck indefinitely and completes normally other than errors about the missing fonts).

Also what I found works is running godot . --import --headless --quit-after 5 before the export. That was from some earlier issues about the export process being stuck, but I personally didn't have to put those in my project for 4.3 as I didn't experience the getting stuck issue there. But now in 4.4 it seems like I do need the workaround.

Also to narrow things down I confirmed the same problem on my desktop outside the container environment and even running in non-headless mode. What I saw was that if I deleted the imported fonts from my .godot folder and opened the Godot Editor window to my project, that would forever hang like this as well:

Image

So yeah to my eyes this seems to be a general bug with font importing in Godot 4.4 where it for some reason gets stuck when it is depended on to complete.

Steps to reproduce

Here is a Dockerfile which when run with podman build should show the issue of getting stuck:

FROM fedora:41

RUN dnf install -y --setopt=deltarpm=false git git-lfs unzip wget dotnet-sdk-9.0 \
    gettext p7zip fontconfig && dnf clean all
RUN git lfs install

# Godot install
ENV GODOT_VERSION "4.4"

RUN wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_mono_linux_x86_64.zip \
    && wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_mono_export_templates.tpz \
    && mkdir .p ~/.cache \
    && mkdir -p ~/.config/godot \
    && mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable.mono \
    && unzip Godot_v${GODOT_VERSION}-stable_mono_linux_x86_64.zip \
    && mv Godot_v${GODOT_VERSION}-stable_mono_linux_x86_64 godot_dir \
    && mv godot_dir/* /usr/local/bin/ \
    && ln -s /usr/local/bin/Godot_v${GODOT_VERSION}-stable_mono_linux.x86_64 /usr/local/bin/godot \
    && unzip Godot_v${GODOT_VERSION}-stable_mono_export_templates.tpz \
    && mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable.mono \
    && mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable.mono/ \
    && rm Godot_v${GODOT_VERSION}-stable_mono_export_templates.tpz Godot_v${GODOT_VERSION}-stable_mono_linux_x86_64.zip \
    && rm -rf templates godot_dir

# Godot pck tool
ENV PCK_TOOL_VERSION "v2.1"

RUN wget https://github.com/hhyyrylainen/GodotPckTool/releases/download/${PCK_TOOL_VERSION}/godotpcktool -O /usr/bin/godotpcktool && \
    chmod +x /usr/bin/godotpcktool

# Start of the sample project showing the issue
RUN git clone https://github.com/Revolutionary-Games/Thrive.git /Thrive

RUN cd /Thrive && git checkout 5bd14292c3000b66cf46d83e881eebc3a53c4a00

RUN cd /Thrive && git submodule update --init

RUN cd /Thrive && dotnet run --project Scripts -- native Fetch Install --debug false

# Uncomment the following line to stop the problem with getting stuck:
# RUN rm -rf /Thrive/assets/fonts

# Or uncomment the following line, which also seems to fix the problem:
# RUN cd /Thrive && godot . --import --headless --quit-after 5

# This gets stuck when trying to import the fonts for exporting with Godot
RUN cd /Thrive && dotnet run --project Scripts -- package --dehydrated Linux

I included the two workarounds as well which can be uncommented to see how the podman build doesn't get stuck with those workarounds enabled.

For me running that Dockerfile always ends with it being stuck like this:

	reimport: step 39: NotoSansSinhala-Black.ttf
	reimport: step 40: NotoSansHebrew-SemiBold.ttf
	reimport: step 41: NotoSansHebrew-Regular.ttf
	reimport: step 42: NotoSansHebrew-Light.ttf
	reimport: step 43: NotoSansHebrew-Bold.ttf
	reimport: step 44: NotoSansHebrew-Black.ttf
	reimport: step 45: NotoSansGeorgian-SemiBold.ttf

Minimal reproduction project (MRP)

The Dockerfile I included demonstrates the problem when it is built.
The font files are pretty big so even just including those in a test project might make it too big to upload.

@dligr
Copy link

dligr commented Mar 8, 2025

I've run into a similar issue trying to load a project in Godot 4.4. There appeared to be an endless asset reimport:
Image

Deleting the font .import files made the editor load normally, however.
After Godot remade the .import files, I reverted the changes done to them (using Git), and the editor was still able to load normally - with the same files as when it was stuck reimporting assets.

@hhyyrylainen
Copy link
Author

hhyyrylainen commented Mar 10, 2025

I had a team member who converted our fonts to .woff format to try and that runs in the same issue. So the problem doesn't seem to be specifically in .ttf parsing but font importing in general.

@akien-mga akien-mga added this to the 4.5 milestone Mar 10, 2025
@akien-mga akien-mga moved this from Unassessed to Very Bad in 4.x Release Blockers Mar 10, 2025
@akien-mga
Copy link
Member

CC @bruvzg

@bruvzg bruvzg self-assigned this Mar 10, 2025
@HyperbolicHadron
Copy link

HyperbolicHadron commented Mar 11, 2025

I have narrowed down the problem to being an issue with the font fallbacks system in Godot during import. If the fallbacks are removed in the project for each font's .import file, then the issue goes away. This PR shows what this temporary fix looks like for a project: Revolutionary-Games/Thrive#6008

We are currently unable to use this temporary fix in our project however, as the fallbacks are necessary for us.

@bruvzg
Copy link
Member

bruvzg commented Mar 12, 2025

Seems to be caused by #96593, font fallbacks connect changed signal, and all resource loader threads get stuck writing for semaphore post on main thread, while main thread is waiting for resources to load and not processing events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Very Bad
Development

Successfully merging a pull request may close this issue.

6 participants