Closed akien-mga closed 12 months ago
Did some more testing, I'm not sure anymore whether it's a regression, and it only seems to appear with a somewhat baroque setup.
My Godot 4.1.3 is used self-contained, so it doesn't share its editor data with my 4.2 snapshots / git builds, which are not self-contained and use the editor data installed in the default user folders (notably ~/.cache/godot
for the cache).
This seems to be important, and the problem seems related to generating the .godot
folder with the self-contained Godot 4.1.3, then opening the project in Godot 4.2 after having deleted ~/.cache/godot
- can be done before importing in 4.1.3 or after, that doesn't seem to make a difference (which is logical as the self-contained 4.1.3 won't touch it).
So @YuriSizov and I did some digging, and the problem is indeed tied to using self-contained editors / separate editor caches in the migration from a .godot
folder imported in 4.1.x to Godot 4.2.
Our friend SurfaceUpgradeTool
seems to be involved, as one of the other waiting threads shows:
Thread 26 (Thread 0x7f8735ffc6c0 (LWP 182795) "godot.linuxbsd."):
#0 0x00007f87a555e756 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1 0x00007f87a5560dc8 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#2 0x00000000092164ee in Semaphore::wait (this=0xcc2b368) at ./core/os/semaphore.h:65
#3 CommandQueueMT::push_and_ret<RendererViewport, RID (RendererViewport::*)(RID) const, RID, RID> (this=0xcc2b358, p_instance=0xca121d0, p_method=(RID (RendererViewport::*)(const RendererViewport * const, RID)) 0x91638e0 <RendererViewport::viewport_get_texture(RID) const>, p1=..., r_ret=0x7f8735ff1458) at ./core/templates/command_queue_mt.h:396
#4 0x00000000091f6366 in RenderingServerDefault::viewport_get_texture (this=0xcc2b130, p1=...) at ./servers/rendering/rendering_server_default.h:622
#5 0x0000000007df5a00 in Viewport::Viewport (this=0x7f8724540af0) at ./scene/main/viewport.cpp:4790
#6 0x0000000007e16bb9 in Window::Window (this=0x7f8724540af0) at ./scene/main/window.cpp:2940
#7 0x0000000007f4de16 in AcceptDialog::AcceptDialog (this=0x7f8724540af0) at ./scene/gui/dialogs.cpp:402
#8 0x0000000007f4e6cb in ConfirmationDialog::ConfirmationDialog (this=0x7f8724540af0) at ./scene/gui/dialogs.cpp:460
#9 0x00000000071127be in EditorNode::immediate_confirmation_dialog (p_text=..., p_ok_text=..., p_cancel_text=..., p_wrap_width=500) at ./editor/editor_node.cpp:5539
#10 0x00000000073d2aa4 in SurfaceUpgradeTool::_show_popup (this=0xe585290) at ./editor/surface_upgrade_tool.cpp:84
#11 0x00000000073d290c in SurfaceUpgradeTool::_try_show_popup () at ./editor/surface_upgrade_tool.cpp:70
#12 0x0000000008d9d253 in RenderingServer::fix_surface_compatibility (this=0xcc2b130, p_surface=..., p_path=...) at ./servers/rendering_server.cpp:2135
#13 0x000000000885523a in ArrayMesh::_set_surfaces (this=0x7f87244795c0, p_surfaces=...) at ./scene/resources/mesh.cpp:1643
#14 0x0000000007ec3cdf in call_with_variant_args_helper<__UnexistingClass, Array const&, 0ul> (p_instance=0x7f87244795c0, p_method=(void (__UnexistingClass::*)(__UnexistingClass * const, const Array &)) 0x88542e8 <ArrayMesh::_set_surfaces(Array const&)>, p_args=0x7f8735ff2468, r_error=...) at ./core/variant/binder_common.h:303
#15 0x0000000007ea8ee6 in call_with_variant_args_dv<__UnexistingClass, Array const&> (p_instance=0x7f87244795c0, p_method=(void (__UnexistingClass::*)(__UnexistingClass * const, const Array &)) 0x88542e8 <ArrayMesh::_set_surfaces(Array const&)>, p_args=0x7f8735ff2508, p_argcount=1, r_error=..., default_values=...) at ./core/variant/binder_common.h:450
#16 0x0000000007e90602 in MethodBindT<Array const&>::call (this=0xdf9a400, p_object=0x7f87244795c0, p_args=0x7f8735ff2508, p_arg_count=1, r_error=...) at ./core/object/method_bind.h:335
#17 0x0000000009e04780 in ClassDB::set_property (p_object=0x7f87244795c0, p_property=..., p_value=..., r_valid=0x0) at ./core/object/class_db.cpp:1235
#18 0x0000000009e0d5ba in Object::set (this=0x7f87244795c0, p_name=..., p_value=..., r_valid=0x0) at ./core/object/object.cpp:257
#19 0x00000000099d4bfb in ResourceLoaderBinary::load (this=0x7f8735ff2960) at ./core/io/resource_format_binary.cpp:832
#20 0x00000000099d70a6 in ResourceFormatLoaderBinary::load (this=0xbe72f70, p_path=..., p_original_path=..., r_error=0x7f872407dd6c, p_use_sub_threads=false, r_progress=0x7f872407dd60, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./core/io/resource_format_binary.cpp:1196
#21 0x00000000099e4b2d in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE, r_error=0x7f872407dd6c, p_use_sub_threads=false, r_progress=0x7f872407dd60) at ./core/io/resource_loader.cpp:261
--Type <RET> for more, q to quit, c to continue without paging--c
#22 0x00000000099e0f37 in ResourceFormatImporter::load (this=0xbe73270, p_path=..., p_original_path=..., r_error=0x7f872407dd6c, p_use_sub_threads=false, r_progress=0x7f872407dd60, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./core/io/resource_importer.cpp:139
#23 0x00000000099e4b2d in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE, r_error=0x7f872407dd6c, p_use_sub_threads=false, r_progress=0x7f872407dd60) at ./core/io/resource_loader.cpp:261
#24 0x00000000099e524c in ResourceLoader::_thread_load_function (p_userdata=0x7f872407dd18) at ./core/io/resource_loader.cpp:319
#25 0x00000000099e5e91 in ResourceLoader::_load_start (p_path=..., p_type_hint=..., p_thread_mode=ResourceLoader::LOAD_THREAD_FROM_CURRENT, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./core/io/resource_loader.cpp:498
#26 0x00000000088c7ea5 in ResourceLoaderText::load (this=0x7f8735ff39b0) at ./scene/resources/resource_format_text.cpp:467
#27 0x00000000088d3afd in ResourceFormatLoaderText::load (this=0xcbfcf00, p_path=..., p_original_path=..., r_error=0x7f8724082ccc, p_use_sub_threads=false, r_progress=0x7f8724082cc0, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./scene/resources/resource_format_text.cpp:1651
#28 0x00000000099e4b2d in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE, r_error=0x7f8724082ccc, p_use_sub_threads=false, r_progress=0x7f8724082cc0) at ./core/io/resource_loader.cpp:261
#29 0x00000000099e524c in ResourceLoader::_thread_load_function (p_userdata=0x7f8724082c78) at ./core/io/resource_loader.cpp:319
#30 0x00000000099e5e91 in ResourceLoader::_load_start (p_path=..., p_type_hint=..., p_thread_mode=ResourceLoader::LOAD_THREAD_FROM_CURRENT, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./core/io/resource_loader.cpp:498
#31 0x00000000088c7ea5 in ResourceLoaderText::load (this=0x7f8735ff6880) at ./scene/resources/resource_format_text.cpp:467
#32 0x00000000088d3afd in ResourceFormatLoaderText::load (this=0xcbfcf00, p_path=..., p_original_path=..., r_error=0x7f8724081bac, p_use_sub_threads=false, r_progress=0x7f8724081ba0, p_cache_mode=ResourceFormatLoader::CACHE_MODE_IGNORE) at ./scene/resources/resource_format_text.cpp:1651
#33 0x00000000099e4b2d in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_IGNORE, r_error=0x7f8724081bac, p_use_sub_threads=false, r_progress=0x7f8724081ba0) at ./core/io/resource_loader.cpp:261
#34 0x00000000099e524c in ResourceLoader::_thread_load_function (p_userdata=0x7f8724081b58) at ./core/io/resource_loader.cpp:319
#35 0x00000000099e5e91 in ResourceLoader::_load_start (p_path=..., p_type_hint=..., p_thread_mode=ResourceLoader::LOAD_THREAD_FROM_CURRENT, p_cache_mode=ResourceFormatLoader::CACHE_MODE_IGNORE) at ./core/io/resource_loader.cpp:498
#36 0x00000000099e5989 in ResourceLoader::load (p_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_IGNORE, r_error=0x0) at ./core/io/resource_loader.cpp:415
#37 0x0000000008882dc7 in PackedScene::reload_from_file (this=0x7f872506c4c0) at ./scene/resources/packed_scene.cpp:1921
#38 0x0000000005f93bd2 in GDScriptCache::get_packed_scene (p_path=..., r_error=@0x7f8735ff8fa4: OK, p_owner=...) at ./modules/gdscript/gdscript_cache.cpp:395
#39 0x0000000005f82225 in GDScriptAnalyzer::reduce_preload (this=0x7f8735ffab60, p_preload=0x7f87245c0620) at ./modules/gdscript/gdscript_analyzer.cpp:4158
#40 0x0000000005f76db4 in GDScriptAnalyzer::reduce_expression (this=0x7f8735ffab60, p_expression=0x7f87245c0620, p_is_root=false) at ./modules/gdscript/gdscript_analyzer.cpp:2466
#41 0x0000000005f7352c in GDScriptAnalyzer::resolve_assignable (this=0x7f8735ffab60, p_assignable=0x7f872419e830, p_kind=0x3bb7d02 "constant") at ./modules/gdscript/gdscript_analyzer.cpp:1890
#42 0x0000000005f741ee in GDScriptAnalyzer::resolve_constant (this=0x7f8735ffab60, p_constant=0x7f872419e830, p_is_local=false) at ./modules/gdscript/gdscript_analyzer.cpp:2003
#43 0x0000000005f6e03b in GDScriptAnalyzer::resolve_class_member (this=0x7f8735ffab60, p_class=0x7f87254d3a00, p_index=0, p_source=0x7f872419e830) at ./modules/gdscript/gdscript_analyzer.cpp:983
#44 0x0000000005f6f478 in GDScriptAnalyzer::resolve_class_interface (this=0x7f8735ffab60, p_class=0x7f87254d3a00, p_source=0x7f87254d3a00) at ./modules/gdscript/gdscript_analyzer.cpp:1185
#45 0x0000000005f6f649 in GDScriptAnalyzer::resolve_class_interface (this=0x7f8735ffab60, p_class=0x7f87254d3a00, p_recursive=true) at ./modules/gdscript/gdscript_analyzer.cpp:1213
#46 0x0000000005f89d03 in GDScriptAnalyzer::resolve_interface (this=0x7f8735ffab60) at ./modules/gdscript/gdscript_analyzer.cpp:5534
#47 0x0000000005f89f43 in GDScriptAnalyzer::analyze (this=0x7f8735ffab60) at ./modules/gdscript/gdscript_analyzer.cpp:5569
#48 0x0000000005f5a970 in GDScript::reload (this=0x7f8724016c00, p_keep_state=true) at ./modules/gdscript/gdscript.cpp:753
#49 0x0000000005f933ce in GDScriptCache::get_full_script (p_path=..., r_error=@0x7f8735ffb10c: OK, p_owner=..., p_update_from_disk=false) at ./modules/gdscript/gdscript_cache.cpp:303
#50 0x0000000005f66dcf in ResourceFormatLoaderGDScript::load (this=0xc35cb30, p_path=..., p_original_path=..., r_error=0x7f872452546c, p_use_sub_threads=false, r_progress=0x7f8724525460, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./modules/gdscript/gdscript.cpp:2699
#51 0x00000000099e4b2d in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE, r_error=0x7f872452546c, p_use_sub_threads=false, r_progress=0x7f8724525460) at ./core/io/resource_loader.cpp:261
#52 0x00000000099e524c in ResourceLoader::_thread_load_function (p_userdata=0x7f8724525418) at ./core/io/resource_loader.cpp:319
#53 0x00000000099e5e91 in ResourceLoader::_load_start (p_path=..., p_type_hint=..., p_thread_mode=ResourceLoader::LOAD_THREAD_FROM_CURRENT, p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE) at ./core/io/resource_loader.cpp:498
#54 0x00000000099e5989 in ResourceLoader::load (p_path=..., p_type_hint=..., p_cache_mode=ResourceFormatLoader::CACHE_MODE_REUSE, r_error=0x0) at ./core/io/resource_loader.cpp:415
#55 0x000000000745b0ff in EditorResourcePreviewGenerator::generate_from_path (this=0x1d32d870, p_path=..., p_size=..., p_metadata=...) at ./editor/editor_resource_preview.cpp:68
#56 0x000000000745bd1e in EditorResourcePreview::_generate_preview (this=0xf3560f0, r_texture=..., r_small_texture=..., p_item=..., cache_base=..., p_metadata=...) at ./editor/editor_resource_preview.cpp:159
#57 0x000000000745ca9a in EditorResourcePreview::_iterate (this=0xf3560f0) at ./editor/editor_resource_preview.cpp:250
#58 0x000000000745d528 in EditorResourcePreview::_thread (this=0xf3560f0) at ./editor/editor_resource_preview.cpp:337
#59 0x000000000745b6bc in EditorResourcePreview::_thread_func (ud=0xf3560f0) at ./editor/editor_resource_preview.cpp:102
#60 0x00000000098d89ae in Thread::callback (p_caller_id=23, p_settings=..., p_callback=0x745b69c <EditorResourcePreview::_thread_func(void*)>, p_userdata=0xf3560f0) at ./core/os/thread.cpp:61
#61 0x00000000098eb6f9 in std::__invoke_impl<void, void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*> (__f=@0x21144868: 0x98d8920 <Thread::callback(unsigned long, Thread::Settings const&, void (*)(void*), void*)>) at /usr/include/c++/12/bits/invoke.h:61
#62 0x00000000098eb5c2 in std::__invoke<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*> (__fn=@0x21144868: 0x98d8920 <Thread::callback(unsigned long, Thread::Settings const&, void (*)(void*), void*)>) at /usr/include/c++/12/bits/invoke.h:96
#63 0x00000000098eb47d in std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul> (this=0x21144848) at /usr/include/c++/12/bits/std_thread.h:279
#64 0x00000000098e9d50 in std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*> >::operator() (this=0x21144848) at /usr/include/c++/12/bits/std_thread.h:286
#65 0x00000000098e8c02 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*> > >::_M_run (this=0x21144840) at /usr/include/c++/12/bits/std_thread.h:231
#66 0x000000000a2b9193 in std::execute_native_thread_routine (__p=0x21144840) at ../../../../../libstdc++-v3/src/c++11/thread.cc:82
#67 0x00007f87a55618da in start_thread () from /lib64/libc.so.6
#68 0x00007f87a55dd48c in clone3 () from /lib64/libc.so.6
To reproduce this consistently, these are clearer steps:
$ find godots
godots
godots/4.1.3-stable_sc
godots/4.1.3-stable_sc/._sc_
godots/4.1.3-stable_sc/Godot_v4.1.3-stable_linux.x86_64
godots/4.2-beta_sc
godots/4.2-beta_sc/._sc_
godots/4.2-beta_sc/godot.linuxbsd.editor.dev.x86_64
.godot
folder)godots/4.1.3-stable_sc/Godot_v4.1.3-stable_linux.x86_64 -e
, let it import everything
This generates the .godot
folder in the TPS demo, and a bunch of editor data within the self-contained 4.1.3-stable_sc/editor_data
foldergodots/4.2-beta_sc/godot.linuxbsd.editor.dev.x86_64 -e
, see the deadlockNot the good way to go probably, but we're seeing more than one "regression" on imported files in the .godot folder. Would it make sense to force a full reimport upon minor release?
@QbieShay Do you have specific issues in mind? Because this one is not about imported assets. It's about threading issues in the resource preview generator, something that we unfortunately always had. A full reimport doesn't help, not directly at least. You may offset timing of some things and "fix" the issue, but this doesn't really address the problem at its core.
Godot version
4.2.beta5,
master
(e38686f85b768a451dc06324fe2471adc8665448)System information
Mageia 9 - Vulkan (Forward+) - dedicated AMD Radeon RX Vega M GL Graphics (RADV VEGAM) () - Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz (8 Threads)
Issue description
I noticed a deadlock in
GDScriptCache::get_full_script
when trying to open GDQuest's 3D TPS demo in 4.2 beta 5 and latestmaster
(e38686f85b768a451dc06324fe2471adc8665448). I haven't yet tested earlier versions to see whether I can pinpoint a regression time, I'll do that next.It happens when opening the project in Godot 4.2 after having opened it once in 4.1.3, ensuring that all files in
.godot
have been generated by 4.1.3.The editor freezes, and attaching a debugger gives me this stacktrace of where it seems to be stuck, on a mutex in
GDScriptCache::get_full_script
:Steps to reproduce
Edit: See below, at least one of the two Godot versions must be self-contained to reproduce the issue.
.godot
is deleted, also remove the Godot cache for good measure (~/.cache/godot/
or similar locations) - that last part may not be needed but I haven't tested without that step.git checkout
any changes made by Godot 4.2, clean.godot
, etc.Minimal reproduction project
Not really minimal, I haven't yet tried to narrow it down. But the stacktrace suggests an issue with GDScript, possibly preloading or cyclic references.