utopia-rise / fmod-gdextension

FMOD Studio GDExtension bindings for the Godot game engine
MIT License
485 stars 52 forks source link

The editor and builds crash on closing after activating FMOD for the first time #282

Open caphhe opened 6 days ago

caphhe commented 6 days ago

Add-on Version: Release 4.3.0-4.2.2 Engine: Godot Engine v4.3.1.stable.custom_build and Godot Engine v4.3.stable.official Running on Windows 10.

Hi The editor and the windows builds crash when closing. This is blocks the reload current project function and is not good for a release build. The problem is reproducible in an empty project, by just adding the fmod extension in the addons folder and activating the plugin. The crash happens only after activating the plugin once, but afterwards it does not matter if the checkmark for the plugin is set or not. The fmod extension seems to initialize itself no matter what. The crash only stops if the fmod addon files are removed.

I have build a engine version with the debugsymbols to get a stacktrace and there are two different traces with the empty project.

  1. Without adding any banks (there is a warning for not finding the banks):
    
    C:\Godot 4_3\bin>start /b /w  godot.windows.editor.dev.x86_64.console.exe
    Godot Engine v4.3.1.stable.custom_build - https://godotengine.org
    OpenGL API 3.3.0 NVIDIA 566.03 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

Editing project: C:/Users/caphh/Documents/fmodtest Godot Engine v4.3.1.stable.custom_build - https://godotengine.org WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2427284306368 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer_VERBOSE does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2427284306368 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer_DEBUG does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2427284306368 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files. Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2427284306368 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

FMOD Sound System: Successfully initialized WARNING: Cannot find master strings bank at res:///Master.strings.bankvoid __cdecl godot::FmodEditorPlugin::_ready(void)src\tools\fmod_editor_plugin.cpp112 at: VariantUtilityFunctions::push_warning (core\variant\variant_utility.cpp:1112) WARNING: res://addons/fmod/tool/property_editors/FmodGuidAndPathPropertyEditorUi.tscn:4 - ext_resource, invalid UID: uid://dca7c6jnnpl0f - using text path instead: res://addons/fmod/icons/event_icon.svg at: ResourceLoaderText::load (scene\resources\resource_format_text.cpp:453) FMOD Sound System: System released

================================================================ CrashHandlerException: Program crashed Engine version: Godot Engine v4.3.1.stable.custom_build Dumping the backtrace. Please include this when reporting the bug to the project developer. [0] RefCounted::unreference (C:\Godot 4_3\core\object\ref_counted.cpp:85) [1] Variant::_clear_internal (C:\Godot 4_3\core\variant\variant.cpp:1388) [2] Variant::clear (C:\Godot 4_3\core\variant\variant.h:311) [3] Variant::~Variant (C:\Godot 4_3\core\variant\variant.h:804) [4] Variant::scalar deleting destructor' [5] CowData<Variant>::_unref (C:\Godot 4_3\core\templates\cowdata.h:264) [6] CowData<Variant>::~CowData<Variant> (C:\Godot 4_3\core\templates\cowdata.h:478) [7] Vector<Variant>::~Vector<Variant> (C:\Godot 4_3\core\templates\vector.h:291) [8] GDScriptLambdaCallable::~GDScriptLambdaCallable (C:\Godot 4_3\modules\gdscript\gdscript_lambda_callable.h:68) [9] GDScriptLambdaCallable::scalar deleting destructor' [10] memdelete (C:\Godot 4_3\core\os\memory.h:119) [11] Callable::~Callable (C:\Godot 4_3\core\variant\callable.cpp:432) [12] Performance::MonitorCall::~MonitorCall [13] KeyValue<StringName,Performance::MonitorCall>::~KeyValue<StringName,Performance::MonitorCall> [14] HashMapElement<StringName,Performance::MonitorCall>::~HashMapElement<StringName,Performance::MonitorCall> [15] HashMapElement<StringName,Performance::MonitorCall>::scalar deleting destructor' [16] memdelete<HashMapElement<StringName,Performance::MonitorCall> > (C:\Godot 4_3\core\os\memory.h:119) [17] DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> >::delete_allocation (C:\Godot 4_3\core\os\memory.h:221) [18] HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > >::clear (C:\Godot 4_3\core\templates\hash_map.h:266) [19] HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > >::~HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > > (C:\Godot 4_3\core\templates\hash_map.h:618) [20] Performance::~Performance [21] Performance::scalar deleting destructor' [22] memdelete (C:\Godot 4_3\core\os\memory.h:119) [23] Main::cleanup (C:\Godot 4_3\main\main.cpp:4351) [24] widechar_main (C:\Godot 4_3\platform\windows\godot_windows.cpp:186) [25] _main (C:\Godot 4_3\platform\windows\godot_windows.cpp:206) [26] main (C:\Godot 4_3\platform\windows\godot_windows.cpp:220) [27] WinMain (C:\Godot 4_3\platform\windows\godot_windows.cpp:234) [28] __scrt_common_main_seh (D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288) [29] <couldn't map PC to fn name> -- END OF BACKTRACE --

2.  With a simple master.bank and master.string.bank

Microsoft Windows [Version 10.0.19045.5131] (c) Microsoft Corporation. Alle Rechte vorbehalten.

C:\Godot 4_3\bin>start /b /w godot.windows.editor.dev.x86_64.console.exe Godot Engine v4.3.1.stable.custom_build - https://godotengine.org OpenGL API 3.3.0 NVIDIA 566.03 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

Editing project: C:/Users/caphh/Documents/fmodtest Godot Engine v4.3.1.stable.custom_build - https://godotengine.org WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2030618444464 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer_VERBOSE does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2030618444464 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message Layer name GalaxyOverlayVkLayer_DEBUG does not conform to naming standard (Policy #LLP_LAYER_3) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2030618444464 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files. Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2030618444464 at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:305) Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

FMOD Sound System: Successfully initialized WARNING: res://addons/fmod/tool/property_editors/FmodGuidAndPathPropertyEditorUi.tscn:4 - ext_resource, invalid UID: uid://dca7c6jnnpl0f - using text path instead: res://addons/fmod/icons/event_icon.svg at: ResourceLoaderText::load (scene\resources\resource_format_text.cpp:453) FMOD Sound System: System released

================================================================ CrashHandlerException: Program crashed Engine version: Godot Engine v4.3.1.stable.custom_build Dumping the backtrace. Please include this when reporting the bug to the project developer. [0] mtx_do_lock (D:\a_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp:88) [1] std::_Mutex_base::lock (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\mutex:50) [2] std::unique_lock::unique_lock (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\mutex:134) [3] MutexLock<MutexImpl >::MutexLock<MutexImpl > (C:\Godot 4_3\core\os\mutex.h:81) [4] GDScript::~GDScript (C:\Godot 4_3\modules\gdscript\gdscript.cpp:1625) [5] GDScript::scalar deleting destructor' [6] memdelete<GDScript> (C:\Godot 4_3\core\os\memory.h:119) [7] Ref<GDScript>::unref (C:\Godot 4_3\core\object\ref_counted.h:212) [8] Ref<GDScript>::~Ref<GDScript> (C:\Godot 4_3\core\object\ref_counted.h:224) [9] GDScriptLambdaCallable::~GDScriptLambdaCallable (C:\Godot 4_3\modules\gdscript\gdscript_lambda_callable.h:68) [10] GDScriptLambdaCallable::scalar deleting destructor' [11] memdelete (C:\Godot 4_3\core\os\memory.h:119) [12] Callable::~Callable (C:\Godot 4_3\core\variant\callable.cpp:432) [13] Performance::MonitorCall::~MonitorCall [14] KeyValue<StringName,Performance::MonitorCall>::~KeyValue<StringName,Performance::MonitorCall> [15] HashMapElement<StringName,Performance::MonitorCall>::~HashMapElement<StringName,Performance::MonitorCall> [16] HashMapElement<StringName,Performance::MonitorCall>::scalar deleting destructor' [17] memdelete<HashMapElement<StringName,Performance::MonitorCall> > (C:\Godot 4_3\core\os\memory.h:119) [18] DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> >::delete_allocation (C:\Godot 4_3\core\os\memory.h:221) [19] HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > >::clear (C:\Godot 4_3\core\templates\hash_map.h:266) [20] HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > >::~HashMap<StringName,Performance::MonitorCall,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Performance::MonitorCall> > > (C:\Godot 4_3\core\templates\hash_map.h:618) [21] Performance::~Performance [22] Performance::scalar deleting destructor' [23] memdelete (C:\Godot 4_3\core\os\memory.h:119) [24] Main::cleanup (C:\Godot 4_3\main\main.cpp:4351) [25] widechar_main (C:\Godot 4_3\platform\windows\godot_windows.cpp:186) [26] _main (C:\Godot 4_3\platform\windows\godot_windows.cpp:206) [27] main (C:\Godot 4_3\platform\windows\godot_windows.cpp:220) [28] WinMain (C:\Godot 4_3\platform\windows\godot_windows.cpp:234) [29] __scrt_common_main_seh (D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288) [30] <couldn't map PC to fn name> -- END OF BACKTRACE --


The crashes in the build look similar but I did not get the stracktrace working. The line "FMOD Sound System: System released" is printed and then it crashes without an error and shows a stacktrace that is not readable without the debugsymbols.
CedNaru commented 6 days ago

I found the cause here: https://github.com/utopia-rise/fmod-gdextension/blob/1a7e466cd50c16adaa7075dae1b21e8c9c494d93/demo/addons/fmod/FmodManager.gd#L6

We added the new PerformanceDisplay in the latest release but forgot to property remove/free it when Godot ends. It probably keeps trying to fetch data from the FmodServer despite it having already been freed.

I tested disabling the PerformanceDisplay and the crash no longer happens.