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

Editor errors on cold start. #1249

Closed
capnm opened this issue Sep 22, 2023 · 8 comments
Closed

Editor errors on cold start. #1249

capnm opened this issue Sep 22, 2023 · 8 comments
Labels

Comments

@capnm
Copy link
Contributor

capnm commented Sep 22, 2023

Godot version

godotengine/godot@fe5b1c8

godot-cpp version

a963b8b

System information

Currently tested with Linux (Ubuntu / debian 11), XDG_SESSION_TYPE = x11

Issue description

To get more reliable and reproducible test results, I usually remove all godot cashes, GDextensions projects then crash the editor at the first start.
[Workaroud: Restart the crashed project (e.g. with godot -e), runs then error-free].

Steps to reproduce

  • rm .godot/extension_list.cfg [or rm -rf .godot]
  • Start GDExtension Project:
ERROR: FATAL: Condition "!exists" is true.
   at: operator[] (./core/templates/hash_map.h:538)

[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3bfd0) [0x7f5d6ac2bfd0] (??:0)

[2] HashMap<StringName, int, HashMapHasherDefault, HashMapComparatorDefault<StringName>, 
DefaultTypedAllocator<HashMapElement<StringName, int> > >::operator[](StringName const&) const
	(./core/templates/hash_map.h:538)

[3] GDScriptCompiler::_prepare_compilation(GDScript*, GDScriptParser::ClassNode const*, bool)
	(./modules/gdscript/gdscript_compiler.cpp:2620)
[4] GDScriptCompiler::compile(GDScriptParser const*, GDScript*, bool) 
	(./modules/gdscript/gdscript_compiler.cpp:3031)

[5] GDScript::reload(bool) (./modules/gdscript/gdscript.cpp:760)

[6] GDScriptCache::get_full_script(String const&, Error&, String const&, bool) 
	(./modules/gdscript/gdscript_cache.cpp:302)

[7] ResourceFormatLoaderGDScript::load(String const&, String const&, Error*,
bool, float*, ResourceFormatLoader::CacheMode)
	(./core/templates/cowdata.h:415)

[8] ResourceLoader::_load(String const&, String const&, String const&, 
ResourceFormatLoader::CacheMode, Error*, bool, float*) 
	(./core/io/resource_loader.cpp:261)
[9] ResourceLoader::_thread_load_function(void*) (./core/io/resource_loader.cpp:319)
[10] ResourceLoader::_load_start(String const&, String const&, ResourceLoader::LoadThreadMode,
ResourceFormatLoader::CacheMode) 
	(./core/io/resource_loader.cpp:499)
[11] ResourceLoader::load(String const&, String const&, ResourceFormatLoader::CacheMode, Error*) 
	(./core/object/ref_counted.h:201)

[12] EditorFileSystem::_update_script_classes() (./core/object/ref_counted.h:109)
[13] EditorFileSystem::reimport_files(Vector<String> const&) (./editor/editor_file_system.cpp:?)
[14] EditorFileSystem::_update_scan_actions() (./editor/editor_file_system.cpp:695)
[15] EditorFileSystem::_notification(int) (./editor/editor_file_system.cpp:1282)

[16] Object::notification(int, bool) (./core/object/object.cpp:831)

[17] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (./scene/main/scene_tree.cpp:?)
[18] SceneTree::_process(bool) (./scene/main/scene_tree.cpp:1020)
[19] SceneTree::process(double) (./scene/main/scene_tree.cpp:510)

[20] Main::iteration() (main/main.cpp:3532)
[21] OS_LinuxBSD::run() (platform/linuxbsd/os_linuxbsd.cpp:933)
[22] godot.linuxbsd.editor.dev.x86_64.llvm(main+0xdc) [0x55c47c006c8c] (platform/linuxbsd/godot_linuxbsd.cpp:76)
[23] /lib/x86_64-linux-gnu/libc.so.6(+0x271ca) [0x7f5d6ac171ca] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f5d6ac17285] (??:0)
[25] godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x2a) [0x55c47c006aea] (??:?)

Minimal reproduction project

N/A

@capnm capnm changed the title Crash on cold start. Editor crash on cold start. Sep 22, 2023
@dsnopek
Copy link
Collaborator

dsnopek commented Sep 22, 2023

This looks to be the same as #1234

I'm pretty sure this is an issue in the GDScript compiler: if a class can't be found, it probably shouldn't crash the whole engine. I don't know if an issue has been submitted on the Godot repo for this yet.

@capnm
Copy link
Contributor Author

capnm commented Sep 22, 2023

My old brain for some reason ;) can't penetrate the Godot source code.
Strangely enough, this works without any issues:

mkdir tmp
cp .godot/extension_list.cfg tmp/
rm -rf .godot/
mv tmp/ .godot/
godot.linuxbsd.editor.dev.x86_64.llvm -e -w

so theoretically the file is created too late.

@dsnopek
Copy link
Collaborator

dsnopek commented Sep 22, 2023

I found the issue that the other reporter created in the Godot repo: godotengine/godot#81478

Can you add what you saw in your experience in a comment there? Thanks!

@dsnopek
Copy link
Collaborator

dsnopek commented Sep 22, 2023

Or, actually, there's an even older one (godotengine/godot#80850) that may benefit from what you wrote in your last comment about the extension_list.cfg not getting created early enough

@capnm
Copy link
Contributor Author

capnm commented Sep 22, 2023

Thanks! It looks like we are all struggling with the same issue.
https://github.com/TokisanGames/Terrain3D/pull/196/files
TokisanGames/Terrain3D#182

IMO the *.gdextension files should be parsed and cached in the .godot/extension_list.cfg file somewhere near the editor start.
If you think this should be a godot issue, IMO the closest duplicate is godotengine/godot#81478 ?

The order in the list is obviously wrong:

image

@dsnopek
Copy link
Collaborator

dsnopek commented Sep 22, 2023

If you think this should be a godot issue

It's definitely an issue on the Godot side, possibly even two issues: (1) the GDScript compiler should probably error when it can't find a class, rather than crashing the whole engine and (2) the order of GDExtension loading and GDScript compiling is not quite right

At this point, the most important thing is probably making sure that all the related issues are linked, and all the relevant information is shared

@capnm
Copy link
Contributor Author

capnm commented Sep 27, 2023

Update
(1) crash has been fixed (godotengine/godot#82294)
(2) Still broken, but you now see the PR errors:

unrelated
ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:106)
----

ERROR: GDScript bug: Native class "Test" not found.
   at: _gdtype_from_datatype (./modules/gdscript/gdscript_compiler.cpp:121)
ERROR: GDScript bug: Native class "Test" not found.
   at: _gdtype_from_datatype (./modules/gdscript/gdscript_compiler.cpp:121)
ERROR: GDScript bug: Native class "Test" not found.
   at: _gdtype_from_datatype (./modules/gdscript/gdscript_compiler.cpp:121)
SCRIPT ERROR: Compile Error: Identifier not found: i_value
          at: GDScript::reload (res://Test.gd:10)
ERROR: Failed to load script "res://Test.gd" with error "Compilation failed".
   at: load (./modules/gdscript/gdscript.cpp:2656)
Test: call of constructor.
...

@capnm capnm changed the title Editor crash on cold start. Editor errors on cold start. Sep 27, 2023
@capnm
Copy link
Contributor Author

capnm commented Oct 12, 2023

Closing as this is an issue on Godot side.

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

No branches or pull requests

3 participants