godotengine / godotengine/godot
Game crashes, but unable to recreate in a simple project, potentially a threading issue.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Happens in 4.1.stable, 4.2.stable, 4.3 own debug build.
### System information
Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2080 Ti (NVIDIA; 31.0.15.3623) - AMD Ryzen Threadripper 3960X 24-Core Processor (48 Threads)
### Issue description
This may be related to other issues such as #70491 and #72491 which refer to issues when option physics/3d/run_on_seperate_thread is enabled. However I don't think the errors are identical.
I get the following error when running through a version with a traceback enabled.
```
USER ERROR: FATAL: Index p_index = 4294967295 is out of bounds (count = 184).
at: LocalVector,class GodotBroadPhase3DBVH::UserCullTestFunction,1,struct AABB,struct Vector3>::TNode,unsigned int,1,0>::operator [] (E:\godotBuild\godot-master\core/templates/local_vector.h:177)
================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.beta.custom_build
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] LocalVector,GodotBroadPhase3DBVH::UserCullTestFunction,1,AABB,Vector3>::TNode,unsigned int,1,0>::operator[] (E:\godotBuild\godot-master\core\templates\local_vector.h:177)
[1] PooledList,GodotBroadPhase3DBVH::UserCullTestFunction,1,AABB,Vector3>::TNode,unsigned int,1,0>::operator[] (E:\godotBuild\godot-master\core\templates\pooled_list.h:90)
[2] BVH_Tree,GodotBroadPhase3DBVH::UserCullTestFunction,1,AABB,Vector3>::item_move (E:\godotBuild\godot-master\core\math\bvh_public.inc:123)
[3] BVH_Manager,GodotBroadPhase3DBVH::UserCullTestFunction,AABB,Vector3,1>::move (E:\godotBuild\godot-master\core\math\bvh.h:201)
[4] BVH_Manager,GodotBroadPhase3DBVH::UserCullTestFunction,AABB,Vector3,1>::move (E:\godotBuild\godot-master\core\math\bvh.h:141)
[5] GodotBroadPhase3DBVH::move (E:\godotBuild\godot-master\servers\physics_3d\godot_broad_phase_3d_bvh.cpp:45)
[6] GodotCollisionObject3D::_update_shapes (E:\godotBuild\godot-master\servers\physics_3d\godot_collision_object_3d.cpp:182)
[7] GodotCollisionObject3D::_shape_changed (E:\godotBuild\godot-master\servers\physics_3d\godot_collision_object_3d.cpp:236)
[8] GodotPhysicsServer3D::_update_shapes (E:\godotBuild\godot-master\servers\physics_3d\godot_physics_server_3d.cpp:1736)
[9] GodotPhysicsServer3D::body_test_motion (E:\godotBuild\godot-master\servers\physics_3d\godot_physics_server_3d.cpp:920)
[10] PhysicsServer3DWrapMT::body_test_motion (E:\godotBuild\godot-master\servers\physics_server_3d_wrap_mt.h:261)
[11] PhysicsBody3D::move_and_collide (E:\godotBuild\godot-master\scene\3d\physics\physics_body_3d.cpp:109)
[12] CharacterBody3D::_move_and_slide_grounded (E:\godotBuild\godot-master\scene\3d\physics\character_body_3d.cpp:159)
[13] CharacterBody3D::move_and_slide (E:\godotBuild\godot-master\scene\3d\physics\character_body_3d.cpp:108)
[14] call_with_validated_variant_args_ret_helper (E:\godotBuild\godot-master\core\variant\binder_common.h:375)
[15] call_with_validated_object_instance_args_ret (E:\godotBuild\godot-master\core\variant\binder_common.h:663)
[16] MethodBindTR::validated_call (E:\godotBuild\godot-master\core\object\method_bind.h:538)
[17] GDScriptFunction::call (E:\godotBuild\godot-master\modules\gdscript\gdscript_vm.cpp:2094)
[18] GDScriptInstance::callp (E:\godotBuild\godot-master\modules\gdscript\gdscript.cpp:2050)
[19] Node::_gdvirtual__physics_process_call<0> (E:\godotBuild\godot-master\scene\main\node.h:352)
[20] Node::_notification (E:\godotBuild\godot-master\scene\main\node.cpp:60)
[21] Node::_notificationv (E:\godotBuild\godot-master\scene\main\node.h:50)
[22] Node3D::_notificationv (E:\godotBuild\godot-master\scene\3d\node_3d.h:52)
[23] CollisionObject3D::_notificationv (E:\godotBuild\godot-master\scene\3d\physics\collision_object_3d.h:38)
[24] PhysicsBody3D::_notificationv (E:\godotBuild\godot-master\scene\3d\physics\physics_body_3d.h:41)
[25] CharacterBody3D::_notificationv (E:\godotBuild\godot-master\scene\3d\physics\character_body_3d.h:38)
[26] Object::notification (E:\godotBuild\godot-master\core\object\object.cpp:906)
[27] SceneTree::_process_group (E:\godotBuild\godot-master\scene\main\scene_tree.cpp:957)
[28] SceneTree::_process (E:\godotBuild\godot-master\scene\main\scene_tree.cpp:1042)
[29] SceneTree::physics_process (E:\godotBuild\godot-master\scene\main\scene_tree.cpp:491)
[30] Main::iteration (E:\godotBuild\godot-master\main\main.cpp:4014)
[31] OS_Windows::run (E:\godotBuild\godot-master\platform\windows\os_windows.cpp:1686)
[32] widechar_main (E:\godotBuild\godot-master\platform\windows\godot_windows.cpp:181)
[33] _main (E:\godotBuild\godot-master\platform\windows\godot_windows.cpp:206)
[34] main (E:\godotBuild\godot-master\platform\windows\godot_windows.cpp:220)
[35] WinMain (E:\godotBuild\godot-master\platform\windows\godot_windows.cpp:234)
[36] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[37]
-- END OF BACKTRACE --
================================================================
```
It may be because I change the disabled state of some CharacterBody3D collision shapes to true, but I have been unable to validate this hypothesis, although using set_deferred to set the property does appear to overcome the crashing which might support this theory, although it is difficult to reproduce the crashing. I have been unable to reproduce this issue in another, simpler project.
It may be that I'm doing the wrong thing which is why it's crashing, but to just stop without reporting an error isn't nice.
for background:
https://forum.godotengine.org/t/crashing-but-why-i-dont-understand-the-error-message/52900/20
### Steps to reproduce
I've been unable to create a minimal reproduction project. It might be the complexity is required for the issue to occur, or I've miss-understood was is occurring. It does not happen all the time.
### Minimal reproduction project (MRP)
N/A
Contributor guide
Assessment
This issue has not been assessed yet.