godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.22k stars 21.22k forks source link

libc++abi: mutex lock failed editor crash #93701

Closed passivestar closed 4 months ago

passivestar commented 4 months ago

Tested versions

v4.3.beta.custom_build [e052a53bb], current master

Worked yesterday

System information

Godot v4.3.beta (e052a53bb) - macOS 14.4.1 - Vulkan (Forward+) - integrated Apple M1 Max - Apple M1 Max (10 Threads)

Issue description

Editor crashes while opening the project, while loading resources

Output:

libc++abi: terminating due to uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument

Call stack:

__cxa_throw (@__cxa_throw:3)
std::__1::__throw_system_error(int, char const*) (@std::__1::__throw_system_error(int, char const*):28)
std::__1::mutex::lock() (@std::__1::mutex::try_lock():3)
MutexImpl<std::__1::mutex>::lock() const (godot/core/os/mutex.h:61)
WorkerThreadPool::_lock_unlockable_mutexes() (godot/core/object/worker_thread_pool.cpp:430)
WorkerThreadPool::wait_for_group_task_completion(long long) (godot/core/object/worker_thread_pool.cpp:638)
ShaderRD::_compile_version(ShaderRD::Version*, int) (godot/servers/rendering/renderer_rd/shader_rd.cpp:522)
ShaderRD::version_set_code(RID, HashMap<String, String, HashMapHasherDefault, HashMapComparatorDefault<String>, DefaultTypedAllocator<HashMapElement<String, String>>> const&, String const&, String const&, String const&, Vector<String> const&) (godot/servers/rendering/renderer_rd/shader_rd.cpp:597)
RendererCanvasRenderRD::CanvasShaderData::set_code(String const&) (godot/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp:2229)
RendererRD::MaterialStorage::shader_set_code(RID, String const&) (godot/servers/rendering/renderer_rd/storage_rd/material_storage.cpp:1916)
CommandQueueMT::_flush() (godot/core/templates/command_queue_mt.h:372)
CommandQueueMT::flush_if_pending() (godot/core/templates/command_queue_mt.h:426)
RenderingServerDefault::texture_replace(RID, RID) (godot/servers/rendering/rendering_server_default.h:196)
NoiseTexture2D::_set_texture_image(Ref<Image> const&) (godot/modules/noise/noise_texture_2d.cpp:118)
NoiseTexture2D::_update_texture() (godot/modules/noise/noise_texture_2d.cpp:211)
CallQueue::_call_function(Callable const&, Variant const*, int, bool) (godot/core/object/message_queue.cpp:220)
CallQueue::flush() (godot/core/object/message_queue.cpp:268)
SceneTree::process(double) (godot/scene/main/scene_tree.cpp:529)
Main::iteration() (godot/main/main.cpp:4099)
OS_MacOS::run() (godot/platform/macos/os_macos.mm:778)
main (godot/platform/macos/godot_main_macos.mm:84)
start (@start:593)

Deleting .godot didn't help

Possibly this PR: https://github.com/godotengine/godot/pull/93695

Steps to reproduce

N/A

Minimal reproduction project (MRP)

Since I don't know the exact cause I don't know how to make an MRP for it. Opening an issue now in case the cause is obvious from the call stack because it worked yesterday so maybe it narrows it down. Will try to isolate it later if it isn't

RandomShaper commented 4 months ago

93709 should do the trick. Please confirm.

However, I'm a bit surprised you run into that in the editor. As far as I can tell, the ill code path can only be triggered when separate thread rendering is enabled, which is not possible in the editor.