Skip to content

Threaded ResourceLoader crash on startup (GDScript) #122539

Description

@Lateasusual

Tested versions

Reproducible on v4.8 current 3defa24

Issue description

Once the project reaches a critical mass of number of GDScript files present, trying to use threaded loading with intermittently fails and crashes in the GDScript loader.

This is possibly related to #120827 which i previously encountered in the same project, but this is a crash instead of a deadlock and occurs without any preload()s present in the project.

Either it results in a crash (stacktrace below)

Stack trace from debug build.
SCRIPT ERROR: Parse Error: Could not resolve inheritance for class "<main>".
          at: GDScript::reload (res://scene/prop/tool/flashlight.tscn::GDScript_ouvoj:1)
[1] 7f7f6303e6f0 (main+3e6f0) - end at uspoof_impl.cpp:0
[2] 556a74966296 (godot.linuxbsd.editor.x86_64+47a7296) - CowData<char32_t>::size() const at /home/chris/src/godot/core/templates/cowdata.h:176
[3] 556a7488acf8 (godot.linuxbsd.editor.x86_64+46cbcf8) - GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, GDScriptParser::Node const*) at /home/chris/src/godot/modules/gdscript/gdscript_analyzer.cpp:350
[4] 556a748a775a (godot.linuxbsd.editor.x86_64+46e875a) - GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, bool) at /home/chris/src/godot/modules/gdscript/gdscript_analyzer.cpp:652
[5] 556a748ee0d2 (godot.linuxbsd.editor.x86_64+472f0d2) - GDScriptParserRef::raise_status(GDScriptParserRef::Status) at /home/chris/src/godot/modules/gdscript/gdscript_cache.cpp:97 (discriminator 2)
[6] 556a7488c13d (godot.linuxbsd.editor.x86_64+46cd13d) - GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, GDScriptParser::Node const*) at /home/chris/src/godot/modules/gdscript/gdscript_analyzer.cpp:483 (discriminator 1)
[7] 556a7488dd08 (godot.linuxbsd.editor.x86_64+46ced08) - GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, bool) at /home/chris/src/godot/modules/gdscript/gdscript_analyzer.cpp:652
[8] 556a748b7ff4 (godot.linuxbsd.editor.x86_64+46f8ff4) - GDScriptAnalyzer::resolve_inheritance() at /home/chris/src/godot/modules/gdscript/gdscript_analyzer.cpp:6704
[9] 556a7486257c (godot.linuxbsd.editor.x86_64+46a357c) - GDScript::reload(bool) (.part.0) at /home/chris/src/godot/modules/gdscript/gdscript.cpp:844
[10] 556a7486365f (godot.linuxbsd.editor.x86_64+46a465f) - GDScript::_set(StringName const&, Variant const&) at /home/chris/src/godot/modules/gdscript/gdscript.cpp:1037
[11] 556a79d0eff2 (godot.linuxbsd.editor.x86_64+9b4fff2) - Object::set(StringName const&, Variant const&, bool*) at /home/chris/src/godot/core/object/object.cpp:294
[12] 556a7856738f (godot.linuxbsd.editor.x86_64+83a838f) - StringName::~StringName() at /home/chris/src/godot/core/string/string_name.h:191 (discriminator 1)
[13] 556a78569686 (godot.linuxbsd.editor.x86_64+83aa686) - ResourceFormatLoaderText::load(String const&, String const&, Error*, bool, float*, ResourceLoaderConstants::CacheMode) at /home/chris/src/godot/scene/resources/resource_format_text.cpp:1467 (discriminator 1)
[14] 556a79895354 (godot.linuxbsd.editor.x86_64+96d6354) - ResourceLoader::_load(String const&, String const&, String const&, ResourceLoaderConstants::CacheMode, Error*, bool, float*) at /home/chris/src/godot/core/io/resource_loader.cpp:289 (discriminator 1)
[15] 556a79896059 (godot.linuxbsd.editor.x86_64+96d7059) - CowData<char32_t>::~CowData() at /home/chris/src/godot/core/templates/cowdata.h:225
[16] 556a79d89093 (godot.linuxbsd.editor.x86_64+9bca093) - __gthread_mutex_lock(pthread_mutex_t*) at /usr/include/c++/16/x86_64-pc-linux-gnu/bits/gthr-default.h:795
[17] 556a79d89863 (godot.linuxbsd.editor.x86_64+9bca863) - WorkerThreadPool::_wait_collaboratively(WorkerThreadPool::ThreadData*, WorkerThreadPool::Task*) at /home/chris/src/godot/core/object/worker_thread_pool.cpp:568
[18] 556a79d8aa22 (godot.linuxbsd.editor.x86_64+9bcba22) - __gthread_mutex_lock(pthread_mutex_t*) at /usr/include/c++/16/x86_64-pc-linux-gnu/bits/gthr-default.h:795
[19] 556a78f08c3e (godot.linuxbsd.editor.x86_64+8d49c3e) - RendererSceneRenderImplementation::RenderForwardClustered::mesh_generate_pipelines(RID, bool) at /home/chris/src/godot/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp:5032 (discriminator 7)
[20] 556a78d25ecc (godot.linuxbsd.editor.x86_64+8b66ecc) - RenderingServerDefault::mesh_create_from_surfaces(Vector<RenderingServerTypes::SurfaceData> const&, int) at /home/chris/src/godot/servers/rendering/rendering_server_default.h:386
[21] 556a784a3bcb (godot.linuxbsd.editor.x86_64+82e4bcb) - ArrayMesh::_set_surfaces(Array const&) at /home/chris/src/godot/scene/resources/mesh.cpp:1690 (discriminator 2)
[22] 556a756168df (godot.linuxbsd.editor.x86_64+54578df) - void call_with_variant_args_helper<__UnexistingClass, Array const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Array const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) at /home/chris/src/godot/core/variant/binder_common.h:58 (discriminator 5)
[23] 556a756169eb (godot.linuxbsd.editor.x86_64+54579eb) - Variant::'unnamed0'::() at /home/chris/src/godot/core/variant/variant.h:255
[24] 556a79ce7d5d (godot.linuxbsd.editor.x86_64+9b28d5d) - Variant::~Variant() at /home/chris/src/godot/core/variant/variant.h:879
[25] 556a79d0ef66 (godot.linuxbsd.editor.x86_64+9b4ff66) - Object::set(StringName const&, Variant const&, bool*) at /home/chris/src/godot/core/object/object.cpp:257 (discriminator 1)
[26] 556a79872082 (godot.linuxbsd.editor.x86_64+96b3082) - Variant::~Variant() at /home/chris/src/godot/core/variant/variant.h:879
[27] 556a798755cb (godot.linuxbsd.editor.x86_64+96b65cb) - ResourceFormatLoaderBinary::load(String const&, String const&, Error*, bool, float*, ResourceLoaderConstants::CacheMode) at /home/chris/src/godot/core/io/resource_format_binary.cpp:1182 (discriminator 1)
[28] 556a79895354 (godot.linuxbsd.editor.x86_64+96d6354) - ResourceLoader::_load(String const&, String const&, String const&, ResourceLoaderConstants::CacheMode, Error*, bool, float*) at /home/chris/src/godot/core/io/resource_loader.cpp:289 (discriminator 1)
[29] 556a7988278d (godot.linuxbsd.editor.x86_64+96c378d) - Ref<Resource>::is_valid() const at /home/chris/src/godot/core/object/ref_counted.h:196
[30] 556a7988288c (godot.linuxbsd.editor.x86_64+96c388c) - ResourceFormatImporter::load(String const&, String const&, Error*, bool, float*, ResourceLoaderConstants::CacheMode) at /home/chris/src/godot/core/io/resource_importer.cpp:169 (discriminator 1)
[31] 556a79895354 (godot.linuxbsd.editor.x86_64+96d6354) - ResourceLoader::_load(String const&, String const&, String const&, ResourceLoaderConstants::CacheMode, Error*, bool, float*) at /home/chris/src/godot/core/io/resource_loader.cpp:289 (discriminator 1)
[32] 556a79896059 (godot.linuxbsd.editor.x86_64+96d7059) - CowData<char32_t>::~CowData() at /home/chris/src/godot/core/templates/cowdata.h:225
[33] 556a79d89093 (godot.linuxbsd.editor.x86_64+9bca093) - __gthread_mutex_lock(pthread_mutex_t*) at /usr/include/c++/16/x86_64-pc-linux-gnu/bits/gthr-default.h:795
[34] 556a79d8958c (godot.linuxbsd.editor.x86_64+9bca58c) - MutexLock<MutexImpl<std::mutex>>::MutexLock(MutexImpl<std::mutex> const&) at /home/chris/src/godot/core/os/mutex.h:77
[35] 556a79682055 (godot.linuxbsd.editor.x86_64+94c3055) - Thread::callback(unsigned long, Thread::Settings const&, void (*)(void*), void*) at /home/chris/src/godot/core/os/thread.cpp:64
[36] 556a7a1846e9 (godot.linuxbsd.editor.x86_64+9fc56e9) - execute_native_thread_routine at uspoof_impl.cpp:0
[37] 7f7f63097f42 (main+97f42) - end at uspoof_impl.cpp:0
[38] 7f7f6311efac (main+11efac) - end at uspoof_impl.cpp:0
-- END OF C++ BACKTRACE --
================================================================

OR

it triggers several GDScript::reload: Parse Error: could not resolve class "..." errors that reference one of the several more commonly inherited-from GDScript classes used multiple places in the scene (but not always the same one) and a random subset of those will not load at all, but the scene still opens just minus those scripts.

Steps to reproduce

Run the MRP using the editor (just run godot in the MRP project folder). It may take multiple attempts to get a crash, ignore any errors that occur if the game doesn't crash.

Minimal Reproduction project (MRP)

gdscript-analyzer-crash copy copy.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions