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 when duplicating instantiated scene that removes child node in _enter_tree #91461

Closed
Pshy0 opened this issue May 2, 2024 · 6 comments · Fixed by #91329 or #91677
Closed

Crash when duplicating instantiated scene that removes child node in _enter_tree #91461

Pshy0 opened this issue May 2, 2024 · 6 comments · Fixed by #91329 or #91677

Comments

@Pshy0
Copy link

Pshy0 commented May 2, 2024

Tested versions

Does not happen in 4.3-dev5
Happens in 4.3-dev6

System information

Godot v4.3.dev6 - Ubuntu 23.10 23.10 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 () - Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz (8 Threads)

Issue description

My game crashes with the following error message:

Godot Engine v4.3.dev6.official.64520fe67 - https://godotengine.org
Vulkan 1.3.242 - Forward+ - Using Device #1: NVIDIA - NVIDIA GeForce GTX 1650

ERROR: Index p_index = 7 is out of bounds ((int)data.children_cache.size() = 7).
   at: get_child (scene/main/node.cpp:1684)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.dev6.official (64520fe6741d8ec3c55e0c9618d3fadcda949f63)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42990) [0x7b67bfc42990] (??:0)
[2] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x429b1a1] (??:0)
[3] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x4871256] (??:0)
[4] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x487132b] (??:0)
[5] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x238816e] (??:0)
[6] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x2334236] (??:0)
[7] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x7e4821] (??:0)
[8] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x6c2be1] (??:0)
[9] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x69abd2] (??:0)
[10] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x4247c9f] (??:0)
[11] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x7d6ec9] (??:0)
[12] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x6c2be1] (??:0)
[13] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x423542f] (??:0)
[14] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x408195f] (??:0)
[15] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x7e2ee4] (??:0)
[16] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x6c2be1] (??:0)
[17] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x423542f] (??:0)
[18] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x408195f] (??:0)
[19] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x7e2ee4] (??:0)
[20] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x6c2be1] (??:0)
[21] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x2318742] (??:0)
[22] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x43c685] (??:0)
[23] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x4216a88] (??:0)
[24] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x2329174] (??:0)
[25] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x23650d3] (??:0)
[26] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x2370790] (??:0)
[27] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x526ab3] (??:0)
[28] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x420042] (??:0)
[29] /lib/x86_64-linux-gnu/libc.so.6(+0x28150) [0x7b67bfc28150] (??:0)
[30] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x89) [0x7b67bfc28209] (??:0)
[31] /home/user/Godot_v4.3-dev6_linux.x86_64() [0x43aaba] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

Run the MRP

Minimal reproduction project (MRP)

s11d-gdproj.zip

@AThousandShips

This comment was marked as outdated.

@Pshy0

This comment was marked as outdated.

@AThousandShips

This comment was marked as outdated.

@Pshy0

This comment was marked as off-topic.

@akien-mga
Copy link
Member

Thanks for making a reproduction project. I can reproduce the bug with it, which should make it easy for contributors to identify what caused the bug and provide a fix.

Backtrace with debug symbols:

ERROR: Index p_index = 0 is out of bounds ((int)data.children_cache.size() = 0).
   at: get_child (./scene/main/node.cpp:1684)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.dev.custom_build (d2dcaf4e537fed11fecf8d3b21735b95058180ce)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x40710) [0x7f83d1616710] (??:0)
[2] Object::get(StringName const&, bool*) const (/home/akien/Godot/godot/./core/object/object.cpp:318)
[3] Node::_duplicate_properties_node(Node const*, Node const*, Node*) const (/home/akien/Godot/godot/./scene/main/node.cpp:2911 (discriminator 2))
[4] Node::_duplicate_properties_node(Node const*, Node const*, Node*) const (/home/akien/Godot/godot/./scene/main/node.cpp:2933 (discriminator 3))
[5] Node::duplicate(int) const (/home/akien/Godot/godot/./scene/main/node.cpp:2825)
[6] void call_with_variant_args_retc_helper<__UnexistingClass, Node*, int, 0ul>(__UnexistingClass*, Node* (__UnexistingClass::*)(int) const, Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul>) (/home/akien/Godot/godot/./core/variant/binder_common.h:807 (discriminator 1))
[7] void call_with_variant_args_retc_dv<__UnexistingClass, Node*, int>(__UnexistingClass*, Node* (__UnexistingClass::*)(int) const, Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (/home/akien/Godot/godot/./core/variant/binder_common.h:569)
[8] MethodBindTRC<Node*, int>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/akien/Godot/godot/./core/object/method_bind.h:619 (discriminator 1))
[9] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/akien/Godot/godot/./modules/gdscript/gdscript_vm.cpp:1862 (discriminator 1))
[10] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/akien/Godot/godot/./modules/gdscript/gdscript.cpp:1981 (discriminator 1))
[11] bool Node::_gdvirtual__ready_call<false>() (/home/akien/Godot/godot/./scene/main/node.h:354 (discriminator 1))
[12] Node::_notification(int) (/home/akien/Godot/godot/./scene/main/node.cpp:214)
[13] Node::_notificationv(int, bool) (/home/akien/Godot/godot/./scene/main/node.h:49 (discriminator 14))
[14] CanvasItem::_notificationv(int, bool) (/home/akien/Godot/godot/./scene/main/canvas_item.h:45 (discriminator 3))
[15] Node2D::_notificationv(int, bool) (/home/akien/Godot/godot/./scene/2d/node_2d.h:37 (discriminator 3))
[16] Object::notification(int, bool) (/home/akien/Godot/godot/./core/object/object.cpp:907)
[17] Node::_propagate_ready() (/home/akien/Godot/godot/./scene/main/node.cpp:269)
[18] Node::_propagate_ready() (/home/akien/Godot/godot/./scene/main/node.cpp:258 (discriminator 3))
[19] Node::_set_tree(SceneTree*) (/home/akien/Godot/godot/./scene/main/node.cpp:3181)
[20] SceneTree::initialize() (/home/akien/Godot/godot/./scene/main/scene_tree.cpp:450)
[21] OS_LinuxBSD::run() (/home/akien/Godot/godot/platform/linuxbsd/os_linuxbsd.cpp:958)
[22] /home/akien/Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64(main+0x14b) [0x5a9b1f1] (/home/akien/Godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:85)
[23] /lib64/libc.so.6(+0x2a088) [0x7f83d1600088] (??:0)
[24] /lib64/libc.so.6(__libc_start_main+0x8b) [0x7f83d160014b] (??:0)
[25] /home/akien/Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64(_start+0x25) [0x5a9afe5] (??:?)
-- END OF BACKTRACE --
================================================================

Judging by the backtrace, I suppose this is related to #87387, CC @warriormaster12 @KoBeWi.

@akien-mga akien-mga added this to the 4.3 milestone May 2, 2024
@akien-mga akien-mga changed the title signal 11 when calling duplicate() - since 4.3-dev6 Crash when duplicating instantiated scene that removes child node in _enter_tree May 2, 2024
@akien-mga akien-mga moved this from Unassessed to Immediate Blocker in 4.x Release Blockers May 2, 2024
@warriormaster12
Copy link
Contributor

@Pshy0 Just pushed a single line change that at least on my end fixed the crash.
#91329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Immediate Blocker
4 participants