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

Crash on project load (Noise Texture?) #58818

Closed
unfa opened this issue Mar 6, 2022 · 19 comments · Fixed by #91630
Closed

Crash on project load (Noise Texture?) #58818

unfa opened this issue Mar 6, 2022 · 19 comments · Fixed by #91630

Comments

@unfa
Copy link

unfa commented Mar 6, 2022

Godot version

v4.0.alpha.calinou.c9d052330

System information

Arch Linux, KDE Plasma, Radeon RX580, amdgpu driver, Vulkan

Issue description

2 our of 3 times I start Godot and load my project, I get an instant crash. It's been here for a while, but with recent nightly builds it's a bit worse for me still.

Here's full terminal output from starting the Editor to loading the project and crashing:

Godot Engine v4.0.alpha.calinou.c9d052330 - https://godotengine.org
ERROR: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        loader_scanned_icd_add: Driver /usr/lib/libvulkan_radeon.so supports Vulkan 1.2, but only supports loader interface version 4. Interface version 5 or newer required to support this version of Vulkan (Policy #LDP_DRIVER_7)
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 94372132429936
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:159)
Vulkan API 1.2.203 - Using Vulkan Device #0: AMD - AMD RADV POLARIS10
 
Editing project: /data/Projects/Games/Liblast/Game (::data::Projects::Games::Liblast::Game)
Godot Engine v4.0.alpha.calinou.c9d052330 - https://godotengine.org
ERROR: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        loader_scanned_icd_add: Driver /usr/lib/libvulkan_radeon.so supports Vulkan 1.2, but only supports loader interface version 4. Interface version 5 or newer required to support this version of Vulkan (Policy #LDP_DRIVER_7)
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 94043202471488
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:159)
Vulkan API 1.2.203 - Using Vulkan Device #0: AMD - AMD RADV POLARIS10
 
WARNING: res://Assets/Effects/ImpactBlood.tscn:4 - ext_resource, invalid UUID: uid://yk4vct6jlpoo - using text path instead: res://Assets/Effects/BloodParticles.tres
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/BloodParticles.tres:3 - ext_resource, invalid UUID: uid://djny4vk6xkldu - using text path instead: res://Assets/Effects/BloodParticles_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/BloodParticles.tres:4 - ext_resource, invalid UUID: uid://cexb4sower0cc - using text path instead: res://Assets/Effects/BloodParticles_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:7 - ext_resource, invalid UUID: uid://jimj50xmfbts - using text path instead: res://Assets/SFX/Weapons_BulletHitPlayer_01.wav
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:8 - ext_resource, invalid UUID: uid://th4fli1vgo1a - using text path instead: res://Assets/Decals/Blood/BloodSplash_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:9 - ext_resource, invalid UUID: uid://pobhi2vhmdpc - using text path instead: res://Assets/Decals/Blood/BloodSplash_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:10 - ext_resource, invalid UUID: uid://bosf0mht2450i - using text path instead: res://Assets/Decals/Blood/BloodSplash_orm.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:4 - ext_resource, invalid UUID: uid://pnh872qjk0oy - using text path instead: res://Assets/Effects/Flame.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:6 - ext_resource, invalid UUID: uid://djny4vk6xkldu - using text path instead: res://Assets/Effects/BloodParticles_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:7 - ext_resource, invalid UUID: uid://xv1jp0gql8tc - using text path instead: res://Assets/SFX/Player_Death_01.wav
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:8 - ext_resource, invalid UUID: uid://cexb4sower0cc - using text path instead: res://Assets/Effects/BloodParticles_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:3 - ext_resource, invalid UUID: uid://th4fli1vgo1a - using text path instead: res://Assets/Decals/Blood/BloodSplash_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:4 - ext_resource, invalid UUID: uid://pobhi2vhmdpc - using text path instead: res://Assets/Decals/Blood/BloodSplash_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:5 - ext_resource, invalid UUID: uid://bosf0mht2450i - using text path instead: res://Assets/Decals/Blood/BloodSplash_orm.png
     at: load (scene/resources/resource_format_text.cpp:431)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.calinou (c9d052330291b726660f3ac397ec82dbcf638bf0)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x42560) [0x7ffae6ef9560] (??:0)
[2] RefCounted::unreference() (??:0)
[3] Ref<Image>::unref() (??:0)
[4] Ref<Image>::ref(Ref<Image> const&) (??:0)
[5] Ref<Image>::operator=(Ref<Image> const&) (??:0)
[6] NoiseTexture::_set_texture_image(Ref<Image> const&) (??:0)
[7] NoiseTexture::_update_texture() (??:0)
[8] void call_with_variant_args_helper<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (??:0)
[9] void call_with_variant_args_dv<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[10] MethodBindT<>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[11] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[12] Callable::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[13] MessageQueue::_call_function(Callable const&, Variant const*, int, bool) (??:0)
[14] MessageQueue::flush() (??:0)
[15] SceneTree::physics_process(double) (??:0)
[16] Main::iteration() (??:0)
[17] OS_LinuxBSD::run() (??:0)
[18] /data/Projects/Games/Liblast/Godot/godot(main+0x168) [0x55881a30228d] (??:0)
[19] /usr/lib/libc.so.6(+0x2d310) [0x7ffae6ee4310] (??:0)
[20] /usr/lib/libc.so.6(__libc_start_main+0x81) [0x7ffae6ee43c1] (??:0)
[21] /data/Projects/Games/Liblast/Godot/godot(_start+0x2a) [0x55881a30206a] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

Clone this project (not the specific commit):
https://codeberg.org/unfa/Liblast/src/commit/4a03995213e6b97c380c07b43366a6e534100033

And open it in the editor.
me an my project team members are often running Godot over and over until it finally doesn't crash on project load.

Minimal reproduction project

No response

@unfa
Copy link
Author

unfa commented Mar 6, 2022

Another case:

Liblast/Godot on  main [$!?] took 3s 
❯  
WARNING: res://Assets/Effects/ImpactBlood.tscn:4 - ext_resource, invalid UUID: uid://yk4vct6jlpoo - using text path instead: res://Assets/Effects/BloodParticles.tres
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/BloodParticles.tres:3 - ext_resource, invalid UUID: uid://djny4vk6xkldu - using text path instead: res://Assets/Effects/BloodParticles_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/BloodParticles.tres:4 - ext_resource, invalid UUID: uid://cexb4sower0cc - using text path instead: res://Assets/Effects/BloodParticles_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:7 - ext_resource, invalid UUID: uid://jimj50xmfbts - using text path instead: res://Assets/SFX/Weapons_BulletHitPlayer_01.wav
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:8 - ext_resource, invalid UUID: uid://th4fli1vgo1a - using text path instead: res://Assets/Decals/Blood/BloodSplash_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:9 - ext_resource, invalid UUID: uid://pobhi2vhmdpc - using text path instead: res://Assets/Decals/Blood/BloodSplash_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/ImpactBlood.tscn:10 - ext_resource, invalid UUID: uid://bosf0mht2450i - using text path instead: res://Assets/Decals/Blood/BloodSplash_orm.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:4 - ext_resource, invalid UUID: uid://pnh872qjk0oy - using text path instead: res://Assets/Effects/Flame.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:6 - ext_resource, invalid UUID: uid://djny4vk6xkldu - using text path instead: res://Assets/Effects/BloodParticles_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:7 - ext_resource, invalid UUID: uid://xv1jp0gql8tc - using text path instead: res://Assets/SFX/Player_Death_01.wav
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Effects/Gibs.tscn:8 - ext_resource, invalid UUID: uid://cexb4sower0cc - using text path instead: res://Assets/Effects/BloodParticles_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:3 - ext_resource, invalid UUID: uid://th4fli1vgo1a - using text path instead: res://Assets/Decals/Blood/BloodSplash_albedo.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:4 - ext_resource, invalid UUID: uid://pobhi2vhmdpc - using text path instead: res://Assets/Decals/Blood/BloodSplash_normal.png
     at: load (scene/resources/resource_format_text.cpp:431)
WARNING: res://Assets/Decals/Blood/BloodSplash.tscn:5 - ext_resource, invalid UUID: uid://bosf0mht2450i - using text path instead: res://Assets/Decals/Blood/BloodSplash_orm.png
     at: load (scene/resources/resource_format_text.cpp:431)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.calinou (c9d052330291b726660f3ac397ec82dbcf638bf0)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x42560) [0x7f5d14057560] (??:0)
[2] StringName::hash() const (??:0)
[3] HashMapHasherDefault::hash(StringName const&) (??:0)
ERROR: Condition "p_I->data != this" is true. Returning: false
   at: erase (./core/templates/list.h:223)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.calinou (c9d052330291b726660f3ac397ec82dbcf638bf0)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[4] HashMap<StringName, ClassDB::ClassInfo, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::get_element(StringName const&) const (??:0)
[5] HashMap<StringName, ClassDB::ClassInfo, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::getptr(StringName const&) (??:0)
[1] /usr/lib/libc.so.6(+0x42560) [0x7f5d14057560] (??:0)
[6] ClassDB::has_signal(StringName const&, StringName const&, bool) (??:0)
[2] HashMap<StringName, List<Pair<StringName const*, int>, DefaultAllocator>::Element*, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::clear() (??:0)
[7] Object::emit_signal(StringName const&, Variant const**, int) (??:0)
[3] HashMap<StringName, List<Pair<StringName const*, int>, DefaultAllocator>::Element*, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::~HashMap() (??:0)
[8] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (??:0)
[4] OrderedHashMap<StringName, int, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::~OrderedHashMap() (??:0)
[9] Resource::emit_changed() (??:0)
[5] GDScriptParser::DataType::~DataType() (??:0)
[10] NoiseTexture::_set_texture_image(Ref<Image> const&) (??:0)
[6] GDScriptParser::Node::~Node() (??:0)
[11] NoiseTexture::_update_texture() (??:0)
[7] GDScriptParser::IfNode::~IfNode() (??:0)
[12] void call_with_variant_args_helper<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (??:0)
[8] void memdelete<GDScriptParser::Node>(GDScriptParser::Node*) (??:0)
[13] void call_with_variant_args_dv<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[9] GDScriptParser::clear() (??:0)
[14] MethodBindT<>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[10] GDScriptParser::~GDScriptParser() (??:0)
[15] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[11] GDScript::reload(bool) (??:0)
[16] Callable::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[12] GDScriptCache::get_full_script(String const&, Error&, String const&) (??:0)
[17] MessageQueue::_call_function(Callable const&, Variant const*, int, bool) (??:0)
[13] ResourceFormatLoaderGDScript::load(String const&, String const&, Error*, bool, float*, ResourceFormatLoader::CacheMode) (??:0)
[18] MessageQueue::flush() (??:0)
[14] ResourceLoader::_load(String const&, String const&, String const&, ResourceFormatLoader::CacheMode, Error*, bool, float*) (??:0)
[19] SceneTree::process(double) (??:0)
[15] ResourceLoader::_thread_load_function(void*) (??:0)
[20] Main::iteration() (??:0)
[16] ResourceLoader::load(String const&, String const&, ResourceFormatLoader::CacheMode, Error*) (??:0)
[21] OS_LinuxBSD::run() (??:0)
[17] EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory*, DirAccess*, EditorFileSystem::ScanProgress const&) (??:0)
[22] /data/Projects/Games/Liblast/Godot/godot(main+0x168) [0x55dedef0228d] (??:0)
[18] EditorFileSystem::_scan_filesystem() (??:0)
[23] /usr/lib/libc.so.6(+0x2d310) [0x7f5d14042310] (??:0)
[19] EditorFileSystem::_thread_func(void*) (??:0)
[24] /usr/lib/libc.so.6(__libc_start_main+0x81) [0x7f5d140423c1] (??:0)
[20] Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*) (??:0)
[25] /data/Projects/Games/Liblast/Godot/godot(_start+0x2a) [0x55dedef0206a] (??:0)
-- END OF BACKTRACE --
================================================================

@unfa
Copy link
Author

unfa commented Mar 6, 2022

Indeed after removing any OpenSimplexNoise resoures from my project the Godot editor finally loads the project without crashing.

@unfa unfa changed the title Crash on project load (Noise Texture?) Crash on project load (Noise Texture) Mar 6, 2022
@unfa
Copy link
Author

unfa commented Mar 6, 2022

Well, maybe it wasn't the solution, because I just had the same crash again:

handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.calinou (c9d052330291b726660f3ac397ec82dbcf638bf0)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[4] Object::emit_signal(StringName const&, Variant const**, int) (??:0)
[1] /usr/lib/libc.so.6(+0x42560) [0x7f1426d55560] (??:0)
[5] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (??:0)
[2] HashMap<StringName, int, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::clear() (??:0)
[6] Resource::emit_changed() (??:0)
[3] HashMap<StringName, int, HashMapHasherDefault, HashMapComparatorDefault<StringName>, (unsigned char)3, (unsigned char)8>::~HashMap() (??:0)
[7] NoiseTexture::_set_texture_image(Ref<Image> const&) (??:0)
[4] GDScriptParser::SuiteNode::~SuiteNode() (??:0)
[8] NoiseTexture::_update_texture() (??:0)
[5] void memdelete<GDScriptParser::Node>(GDScriptParser::Node*) (??:0)
[9] void call_with_variant_args_helper<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (??:0)
[6] GDScriptParser::clear() (??:0)
[10] void call_with_variant_args_dv<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[7] GDScriptParser::~GDScriptParser() (??:0)
[11] MethodBindT<>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[8] GDScript::reload(bool) (??:0)
[12] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[9] GDScriptCache::get_full_script(String const&, Error&, String const&) (??:0)
[13] Callable::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[10] ResourceFormatLoaderGDScript::load(String const&, String const&, Error*, bool, float*, ResourceFormatLoader::CacheMode) (??:0)
[14] MessageQueue::_call_function(Callable const&, Variant const*, int, bool) (??:0)
[11] ResourceLoader::_load(String const&, String const&, String const&, ResourceFormatLoader::CacheMode, Error*, bool, float*) (??:0)
[15] MessageQueue::flush() (??:0)
[12] ResourceLoader::_thread_load_function(void*) (??:0)
[16] SceneTree::physics_process(double) (??:0)
[13] ResourceLoader::load(String const&, String const&, ResourceFormatLoader::CacheMode, Error*) (??:0)
[17] Main::iteration() (??:0)
[14] EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory*, DirAccess*, EditorFileSystem::ScanProgress const&) (??:0)
[18] OS_LinuxBSD::run() (??:0)
[15] EditorFileSystem::_scan_filesystem() (??:0)
[19] /data/Projects/Games/Liblast/Godot/godot(main+0x168) [0x560a2770228d] (??:0)
[16] EditorFileSystem::_thread_func(void*) (??:0)
[20] /usr/lib/libc.so.6(+0x2d310) [0x7f1426d40310] (??:0)
[17] Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*) (??:0)
[21] /usr/lib/libc.so.6(__libc_start_main+0x81) [0x7f1426d403c1] (??:0)
[18] void std::__invoke_impl<void, void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>(std::__invoke_other, void (*&&)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*&&, Thread::Settings&&, void (*&&)(void*), void*&&) (??:0)
[22] /data/Projects/Games/Liblast/Godot/godot(_start+0x2a) [0x560a2770206a] (??:0)
-- END OF BACKTRACE --
================================================================

@unfa
Copy link
Author

unfa commented Mar 8, 2022

This affects other people working on the project as well. Some of us have to run Godot editor 10 times to get a good run and be able to open the project.

I've just had 4 crashes in a row before finally by chance Godot loaded the project instead of crashing.

@unfa unfa changed the title Crash on project load (Noise Texture) Crash on project load (Noise Texture?) Mar 8, 2022
@Calinou
Copy link
Member

Calinou commented Mar 8, 2022

This is likely a race condition as NoiseTexture is generated on a thread.

@unfa
Copy link
Author

unfa commented Mar 8, 2022

I've tried to purge all noise textures from my codebase, as I don't really need them...
The question is - would an OpenSimplexNoise object used in GDScript to animate something also cause this issue?

@Calinou
Copy link
Member

Calinou commented Mar 8, 2022

The question is - would an OpenSimplexNoise object used in GDScript to animate something also cause this issue?

I don't remember if OpenSimplexNoise is generated on a thread, but I think it is too.

Either way, we might replace OpenSimplexNoise with FastNoiseLite for 4.0: #56718

@unfa
Copy link
Author

unfa commented Mar 9, 2022

Is there somethig I can do before that gets merged to workaround this problem?

@Calinou
Copy link
Member

Calinou commented Mar 9, 2022

Is there somethig I can do before that gets merged to workaround this problem?

You could use a statically generated noise image and read its pixels instead of using OpenSimplexNoise.

@unfa
Copy link
Author

unfa commented Mar 9, 2022

Sure, the issue now is how do I locate all the problematic places. Grepping the codebase for "noise" maybe could work?

@Calinou
Copy link
Member

Calinou commented Mar 9, 2022

Sure, the issue now is how do I locate all the problematic places. Grepping the codebase for "noise" maybe could work?

Yes, probably.

@unfa
Copy link
Author

unfa commented Mar 10, 2022

grep -R "OpenSimplexNoise" *

This works.

@cdemirer
Copy link
Contributor

Issue persists after FastNoiseLite.

@clayjohn
Copy link
Member

clayjohn commented Oct 4, 2022

I discussed #66845 with Zylann on Rocketchat and Zylann provided some useful insight:

Just reading NoiseTexture2D, there is threaded stuff in there. Havent finished reading but already seeing one potential problem

void NoiseTexture2D::_thread_function(void *p_ud) {
	NoiseTexture2D *tex = static_cast<NoiseTexture2D *>(p_ud);
	tex->call_deferred(SNAME("_thread_done"), tex->_generate_texture());
}

This doesnt take ownership of the texture, so if the last reference is released before this function completes, it will call on a dangling pointer
It also reads members noise, seamless, color_ramp, etc unprotected
That thread should really receive a copy of all these things and hold one ref on the resource

@Geometror Geometror self-assigned this Dec 27, 2022
@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 27, 2023
@akien-mga
Copy link
Member

Can you still reproduce this in 4.0.3 and 4.1-beta3 or later?

@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@cridenour
Copy link
Contributor

From time to time when loading my project on macOS, I will get a string of dozens of crashes and other times it will load fine. Always from NoiseTexture2D::_generate_texture(). Never have had an issue on Windows.

@YuriSizov
Copy link
Contributor

YuriSizov commented Nov 15, 2023

This seems to be at least somewhat related to #54269. In fact the original stack trace in this issue seems to be exactly the same. So I'll close the other one in favor of this one, which has more discussion.

@KoBeWi
Copy link
Member

KoBeWi commented Jan 17, 2024

Just happened to me on master

CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.dev.custom_build (107f2961ccfac179af7682eb5f6e7ea91e80040c)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] Object::emit_signal<> (C:\godot_source\core\object\object.h:922)
[1] Object::emit_signal<> (C:\godot_source\core\object\object.h:922)
[2] Resource::emit_changed (C:\godot_source\core\io\resource.cpp:45)
[3] NoiseTexture2D::_set_texture_image (C:\godot_source\modules\noise\noise_texture_2d.cpp:124)
[4] NoiseTexture2D::_update_texture (C:\godot_source\modules\noise\noise_texture_2d.cpp:211)
[5] call_with_variant_args_helper<NoiseTexture2D> (C:\godot_source\core\variant\binder_common.h:308)
[6] call_with_variant_args<NoiseTexture2D> (C:\godot_source\core\variant\binder_common.h:418)
[7] CallableCustomMethodPointer<NoiseTexture2D>::call (C:\godot_source\core\object\callable_method_pointer.h:99)
[8] Callable::callp (C:\godot_source\core\variant\callable.cpp:57)
[9] CallQueue::_call_function (C:\godot_source\core\object\message_queue.cpp:222)
[10] CallQueue::flush (C:\godot_source\core\object\message_queue.cpp:328)
[11] SceneTree::physics_process (C:\godot_source\scene\main\scene_tree.cpp:473)
[12] Main::iteration (C:\godot_source\main\main.cpp:3746)
[13] OS_Windows::run (C:\godot_source\platform\windows\os_windows.cpp:1476)
[14] widechar_main (C:\godot_source\platform\windows\godot_windows.cpp:182)
[15] _main (C:\godot_source\platform\windows\godot_windows.cpp:204)
[16] main (C:\godot_source\platform\windows\godot_windows.cpp:218)
[17] WinMain (C:\godot_source\platform\windows\godot_windows.cpp:232)
[18] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[19] <couldn't map PC to fn name>
-- END OF BACKTRACE --

I do sometimes get random crashes when opening project (I think?) and now I was using a debug build, so I managed to catch some stack trace.

@akien-mga
Copy link
Member

Fixed by #91630.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment