-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
[Android Editor] Error parsing editor_settings-4.3.tres
#93826
Comments
I encountered this problem "naturally" (ie not while trying to reproduce it on purpose) on the Meta Quest. After cleaning things up so the editor would run again, I attempted to reproduce the problem on purpose by following the "Steps to reproduce" here and was unable to after many tries. |
We recently updated how we write the editor settings file in #90875, could the issue be related to that? |
That's possible, but given how difficult the issue is to reproduce, it's tricky to debug. I don't see at a glance what could cause a race condition / fail specifically on Android and not other platforms in that code. Maybe some of the DirAccess APIs like I've tried to trigger the bug a dozen times on a Pixel 7a with 4.3-beta3 and didn't succeed so far. |
Yes, it was a custom built debug build. |
I tested on my Android Samsung A14 with Android 14. I was able to reproduce the problem with a custom debug build from master after a couple of "open a project, go back to Project List, reopen project, etc...". Sometimes it needs at least 10 retries. When the problem occurs the content of editor-settings-4.3.tres is empty. I added some debug print in When it works:
When it corrupts the settings file:
To test my hypothesis, I added a 5 sec wait time in I think Android does not always wait for all the resources to finish there destruction before killing the process. The I'm absolutely not an Android programmer so I don't known if something could be done to force Android to wait before killing the process, but I guess the easy fix should be to remove the I let an expert work on that, I hope my debugging could help with this Release Blocker issue. |
Maybe Godot should not react so sensitively if the file I could also reproduce it from 1 second delay. If the delay is removed, the file remains faulty on Android. On Windows 11 there are only problems as long as the delay is present. (Windows Defender could possibly also cause a delay). Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags) {
if (p_path.ends_with(".tscn")) {
packed_scene = p_resource;
}
Error err;
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE, &err);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_OPEN, "Cannot save file '" + p_path + "'.");
Ref<FileAccess> _fref(f);
//print_line("BEGIN DELAY: ", OS::get_singleton()->get_ticks_usec());
//OS::get_singleton()->delay_usec(1000000); // 1 000 000 = 1 sec
//print_line("END DELAY: ", OS::get_singleton()->get_ticks_usec()); |
There is already a fallback to manage if the settings resource is invalid but it was broken by #90875. This line was added before checking if the resource is null in
That could cause the editor to crash and never do the
I'll create a PR to fix that! Technically, it could also happen on any platform. That will not fix the problem where the editor settings file get corrupted on Android, by at least, the editor will no crash on startup. |
That reminds me of #84839, and bug reports in the past (maybe some still current) about the Editor Settings getting wiped for no obvious reason when closing or opening the editor. Sounds like we should look into making things more reliable when it comes to destroying EditorSettings at the right time. |
Shouldn't the |
Thanks for the fix @Hilderin. I think I may have an idea what's the root of the issue on Android. I'll work on a fix. |
Why is this closed if the error itself is not fixed, just the crash? |
I believe I have a fix for the root cause with #94661. Still need to do some validation tests to confirm, at which point I'll take the PR out of draft. @Alex2782 Can you check if #94661 addresses the issue when you add the 1 second delay. |
Tested versions
System information
Android 12, Android 14
Issue description
There is a regression that causes the
editor_settings-4.3.tres
file to be randomly truncated. This seems to be a race condition as the issue doesn't always occur, but when it does, it first causes the editor to crash when re-opening the project, then it causes the editor to crash every time it's opened with the following error logs:The
editor_settings-4.3.tres
file ends up empty.Steps to reproduce
Project
->Quit to project list
to return to the project listNote: As mentioned in the description, this seems to be a race condition so it may take several attempts before it repros, and even then it's not guaranteed to repro
Minimal reproduction project (MRP)
https://godotengine.org/asset-library/asset/2174
The text was updated successfully, but these errors were encountered: