godot-extended-libraries / godot-debug-menu

Display in-game FPS/performance/hardware metrics in a Godot 4.x project
https://github.com/godot-extended-libraries/godot-debug-menu-demo
MIT License
454 stars 18 forks source link

V1.1.1 - Crash on project run for Godot 4.1.0 running on MacOS + ARM #10

Open LaffertyDev opened 1 year ago

LaffertyDev commented 1 year ago

StackTrace:

Godot Engine v4.1.stable.official.970459615 - https://godotengine.org
OpenGL API 4.1 Metal - 83.1 - Compatibility - Using Device: Apple - Apple M1 Pro

  ================================================================
  handle_crash: Program crashed with signal 11
  Engine version: Godot Engine v4.1.stable.official (970459615f6b2b4151742ec6d7ef8559f87fd5c5)
  Dumping the backtrace. Please include this when reporting the bug to the project developer.
  [1] 1   libsystem_platform.dylib            0x00000001a798aa24 _sigtramp + 56
  [2] Ref<DirAccess> DirAccess::_create_builtin<DirAccessUnix>()
  [3] Object::can_translate_messages() const
  [4] VariantInitializer<Vector<Color>>::init(Variant*)
  [5] Object* ClassDB::creator<ENetConnection>()
  [6] Object::get_instance_id() const
  [7] JSON::get_data() const
  [8] VariantInitializer<Vector<Color>>::init(Variant*)
  [9] Object* ClassDB::creator<ENetConnection>()
  [10] RendererRD::ParticlesStorage::_create_particles_material_funcs(RendererRD::MaterialStorage::ShaderData*)
  [11] MutexLock<MutexImpl<std::__1::mutex>>::MutexLock(MutexImpl<std::__1::mutex> const&)
  [12] MutexLock<MutexImpl<std::__1::mutex>>::MutexLock(MutexImpl<std::__1::mutex> const&)
  [13] 13  libsystem_pthread.dylib             0x00000001a795bfa8 _pthread_start + 148
--- Debugging process stopped ---
LaffertyDev commented 1 year ago

As far as I can tell, the culprit is the thread.start line on 120. Commenting that out, removing the thread safety check disabling line, and fixing the indentation gets the project to run just fine.

Calinou commented 1 year ago

RendererRD::ParticlesStorage::_create_particles_material_funcs

Do you have any GPUParticles2D nodes in your project? See https://github.com/godotengine/godot/issues/72469.

LaffertyDev commented 1 year ago

No, definitely not intentionally at least.

And I don't think I have anything in the project that would unintentionally create them. A search for gpu across all of the text files in the repo (including .tscn and .gd) only leaves results in the debug extension files.

Evaluating the trace, I don't think these are probably related... but appreciate the idea :)

Calinou commented 1 year ago

@bruvzg If you run this add-on the Compatibility rendering method with the ANGLE PR, do you get a crash? I'm not on my macOS setup right now, but I could test there if needed.

bruvzg commented 1 year ago

It's not crashing with ANGLE, but I'm getting a lot of multithreading related errors:

With Native GL:

./godot.macos.editor.arm64.angle --rendering-driver opengl3 --path ./gl_test

Godot Engine v4.2.dev.custom_build.4832b046d - https://godotengine.org
OpenGL API 4.1 Metal - 83.1 - Compatibility - Using Device: Apple - Apple M1

ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_viewport_rid (scene/main/viewport.cpp:918)
ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
   at: propagate_notification (scene/main/node.cpp:2208)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev.custom_build (4832b046d3e40b17309d824891c075b354360ca4)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
ERROR: Condition "!viewport" is true.
   at: viewport_set_measure_render_time (servers/rendering/renderer_viewport.cpp:1253)
[1] 1   libsystem_platform.dylib            0x000000018fecaa24 _sigtramp + 56
[2] GLES3::Utilities::get_video_adapter_vendor() const (in godot.macos.editor.arm64.angle) (utilities.cpp:380)
[3] void call_with_ptr_args_retc_helper<__UnexistingClass, String>(__UnexistingClass*, String (__UnexistingClass::*)() const, void const**, void*, IndexSequence<>) (in godot.macos.editor.arm64.angle) (binder_common.h:339)
[4] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (in godot.macos.editor.arm64.angle) (gdscript_vm.cpp:1973)
[5] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (in godot.macos.editor.arm64.angle) (gdscript.cpp:0)
[6] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (in godot.macos.editor.arm64.angle) (object.cpp:717)
[7] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (in godot.macos.editor.arm64.angle) (variant_call.cpp:1174)
[8] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (in godot.macos.editor.arm64.angle) (gdscript_vm.cpp:1690)
[9] GDScriptLambdaSelfCallable::call(Variant const**, int, Variant&, Callable::CallError&) const (in godot.macos.editor.arm64.angle) (gdscript_lambda_callable.cpp:155)
[10] core_bind::Thread::_start_func(void*) (in godot.macos.editor.arm64.angle) (core_bind.cpp:1220)
[11] Thread::callback(unsigned long long, Thread::Settings const&, void (*)(void*), void*) (in godot.macos.editor.arm64.angle) (thread.cpp:63)
[12] void* std::__1::__thread_proxy[abi:v15006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>>(void*) (in godot.macos.editor.arm64.angle) (thread:303)
[13] 13  libsystem_pthread.dylib             0x000000018fe9bfa8 _pthread_start + 148
[14] 14  libsystem_pthread.dylib             0x000000018fe96da0 thread_start + 8
-- END OF BACKTRACE --
================================================================
zsh: abort      ./godot.macos.editor.arm64.angle --rendering-driver opengl3 --path

With ANGLE:

./godot.macos.editor.arm64.angle --rendering-driver opengl3_angle --path ./gl_test

Godot Engine v4.2.dev.custom_build.4832b046d - https://godotengine.org
WARNING: Project setting "rendering/limits/global_shader_variables/buffer_size" exceeds maximum uniform buffer size of: 16384
     at: MaterialStorage (drivers/gles3/storage/material_storage.cpp:1114)
OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.20982 git hash: f3e3810b917c) - Compatibility - Using Device: Google Inc. (Apple) - ANGLE (Apple, ANGLE Metal Renderer: Apple M1, Version 13.4.1 (c) (Build 22F770820d))

ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_viewport_rid (scene/main/viewport.cpp:918)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Information). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3047)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3047)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3047)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_content_scale_mode (scene/main/window.cpp:1309)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_size (scene/main/window.cpp:353)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: is_auto_translating (scene/gui/control.cpp:3047)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: queue_redraw (scene/main/canvas_item.cpp:394)
ERROR: This function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings) can only be accessed from the main thread. Use call_deferred() instead.
   at: update_minimum_size (scene/gui/control.cpp:1597)
ERROR: Caller thread can't call this function in this node (/root/DebugMenu/DebugMenu/VBoxContainer/Settings). Use call_deferred() or call_thread_group() instead.
   at: update_configuration_warnings (scene/main/node.cpp:3047)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_camera_3d (scene/main/viewport.cpp:3686)
ERROR: This function in this node (/root) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
   at: get_msaa_2d (scene/main/viewport.cpp:3162)
ERROR: Condition "!viewport" is true.
   at: viewport_set_measure_render_time (servers/rendering/renderer_viewport.cpp:1253)