Repository navigation
Closed
Description
Godot version
v4.5.2.rc.custom_build (8351a28101ff0b4b7e4c27690b34c1ee2e2330e9)
godot-cpp version
4.5-stable abe9457
System information
Fedora 42, AMD Ryzen 9 7950x
Issue description
after the latest cherrypicks loading the extension in the editor causes a crash around the time it's calling setup on the gui. here's the stack trace
godot-cpp/include/godot_cpp/templates/a_hash_map.hpp:136:34: runtime error: reference binding to null pointer of type 'const struct HashMapData'
godot-cpp/include/godot_cpp/templates/a_hash_map.hpp:136:15: runtime error: load of null pointer of type 'const struct HashMapData'
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.5.2.rc.custom_build (8351a28101ff0b4b7e4c27690b34c1ee2e2330e9)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x1a070) [0x7f3f28fca070] (??:0)
[2] godot::AHashMap<godot::StringName, godot::ClassDB::ClassInfo::VirtualMethod, godot::HashMapHasherDefault, godot::HashMapComparatorDefault<godot::StringName> >::_lookup_pos_with_hash(godot::StringName const&, unsigned int&, unsigned int&, unsigned int) const (??:0)
[3] godot::AHashMap<godot::StringName, godot::ClassDB::ClassInfo::VirtualMethod, godot::HashMapHasherDefault, godot::HashMapComparatorDefault<godot::StringName> >::_lookup_pos(godot::StringName const&, unsigned int&, unsigned int&) const (??:0)
[4] godot::AHashMap<godot::StringName, godot::ClassDB::ClassInfo::VirtualMethod, godot::HashMapHasherDefault, godot::HashMapComparatorDefault<godot::StringName> >::find(godot::StringName const&) const (??:0)
[5] godot::ClassDB::get_virtual_func(void*, void const*, unsigned int) (??:0)
[6] Control::_gdvirtual__get_minimum_size_call(Vector2&) const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.h:401 (discriminator 54))
[7] Control::get_minimum_size() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1686)
[8] Control::_update_minimum_size_cache() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1712)
[9] Control::get_combined_minimum_size() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1722)
[10] TabContainer::get_minimum_size() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/tab_container.cpp:975)
[11] Control::_update_minimum_size_cache() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1712)
[12] Control::get_combined_minimum_size() const (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1722)
[13] Control::_size_changed() (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:1740)
[14] Control::_notification(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:3930)
[15] Control::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.h:46 (discriminator 12))
[16] Container::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/container.h:36)
[17] TabContainer::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/tab_container.h:38)
[18] Object::_notification_forward(int) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.cpp:931)
[19] ThemeOwner::_owner_context_changed() (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.h:893)
[20] ThemeOwner::set_owner_context(ThemeContext*, bool) (/home/jwoon/Documents/GodotTemplates/godot/scene/theme/theme_owner.cpp:87)
[21] Control::set_theme_context(ThemeContext*, bool) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:2926)
[22] Control::_notification(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.cpp:3801 (discriminator 2))
[23] Control::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/control.h:46 (discriminator 12))
[24] Container::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/container.h:36)
[25] TabContainer::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/scene/gui/tab_container.h:38)
[26] Object::_notification_forward(int) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.cpp:931)
[27] Node::_propagate_enter_tree() (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.h:893)
[28] Node::_propagate_enter_tree() (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:360)
[29] Node::_propagate_enter_tree() (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:360)
[30] Node::_propagate_enter_tree() (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:360)
[31] Node::_set_tree(SceneTree*) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:3319)
[32] Node::_add_child_nocheck(Node*, StringName const&, Node::InternalMode) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:1670)
[33] Node::add_child(Node*, bool, Node::InternalMode) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:1700)
[34] EditorNode::set_edited_scene_root(Node*, bool) (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:4161)
[35] EditorNode::set_edited_scene(Node*) (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:4140)
[36] EditorNode::load_scene(String const&, bool, bool, bool, bool) (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:4479)
[37] EditorNode::_load_open_scenes_from_config(Ref<ConfigFile>) (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:5870 (discriminator 2))
[38] EditorNode::_load_editor_layout() (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:5766 (discriminator 3))
[39] EditorNode::_sources_changed(bool) (/home/jwoon/Documents/GodotTemplates/godot/editor/editor_node.cpp:1368)
[40] void call_with_variant_args_helper<EditorNode, bool, 0ul>(EditorNode*, void (EditorNode::*)(bool), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/jwoon/Documents/GodotTemplates/godot/core/variant/binder_common.h:223 (discriminator 5))
[41] void call_with_variant_args<EditorNode, bool>(EditorNode*, void (EditorNode::*)(bool), Variant const**, int, Callable::CallError&) (/home/jwoon/Documents/GodotTemplates/godot/core/variant/binder_common.h:337)
[42] CallableCustomMethodPointer<EditorNode, void, bool>::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/jwoon/Documents/GodotTemplates/godot/core/object/callable_method_pointer.h:103)
[43] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/jwoon/Documents/GodotTemplates/godot/core/variant/callable.cpp:57)
[44] Object::emit_signalp(StringName const&, Variant const**, int) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.cpp:1297)
[45] Node::emit_signalp(StringName const&, Variant const**, int) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/node.cpp:4139)
[46] Error Object::emit_signal<bool>(StringName const&, bool) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.h:944)
[47] EditorFileSystem::_notification(int) (/home/jwoon/Documents/GodotTemplates/godot/editor/file_system/editor_file_system.cpp:1796 (discriminator 4))
[48] EditorFileSystem::_notification_forwardv(int) (/home/jwoon/Documents/GodotTemplates/godot/editor/file_system/editor_file_system.h:148 (discriminator 12))
[49] Object::_notification_forward(int) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.cpp:931)
[50] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/jwoon/Documents/GodotTemplates/godot/core/object/object.h:893)
[51] SceneTree::_process(bool) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/scene_tree.cpp:1279 (discriminator 1))
[52] SceneTree::process(double) (/home/jwoon/Documents/GodotTemplates/godot/scene/main/scene_tree.cpp:706)
[53] Main::iteration() (/home/jwoon/Documents/GodotTemplates/godot/main/main.cpp:4802 (discriminator 4))
[54] OS_LinuxBSD::run() (/home/jwoon/Documents/GodotTemplates/godot/platform/linuxbsd/os_linuxbsd.cpp:989)
[55] /mnt/Forerunner/SteamLibrary/steamapps/common/Godot Engine/godot.x11.opt.tools.64(main+0x2b6) [0x56186e706d1f] (/home/jwoon/Documents/GodotTemplates/godot/platform/linuxbsd/godot_linuxbsd.cpp:85)
[56] /lib64/libc.so.6(+0x3575) [0x7f3f28fb3575] (??:0)
[57] /lib64/libc.so.6(__libc_start_main+0x88) [0x7f3f28fb3628] (??:0)
[58] /mnt/Forerunner/SteamLibrary/steamapps/common/Godot Engine/godot.x11.opt.tools.64(_start+0x25) [0x56186e7069a5] (??:?)
-- END OF C++ BACKTRACE --
================================================================
Steps to reproduce
get the latest cherry picks, try to load a project with it. experience crash
Minimal reproduction project
N/A
Activity
xana43 commentedon Oct 23, 2025
I have confirmed that this issue does not exist when using verson of godot-cpp before this commit
Ivorforce commentedon Oct 23, 2025
Hi! Sorry about the trouble. We had a similar issue a couple of weeks ago (#1862) that has been worked around, but not necessarily solved.
It's unfortunately difficult to solve the issue without a minimal reproduction project, so please provide one and I'll have a look.
xana43 commentedon Oct 23, 2025
creating a minimal reproduction project is taking longer than expected. When I create a minimal reproduction project using all of the supposed recreation criteria in issue #1862 the issue doesn't occur at all in the minimal reproduction project. However in my main project it happens every time. I tried to remove classes that rely on such class hierarchy, and i've also removed certain utility classes that I made that load and do operations before the editor has a chance to set up the gui, and the issue still remains. I've tried to run a debugger to see what other information I can gather, but so far no results have turned up. I will keep trying to make a reproduction project in the mean time.
Ivorforce commentedon Oct 23, 2025
Thanks for putting in the time for it, I appreciate it! Note that the user in #1862 was also unable to pinpoint the exact issue. It's possible that this only occurs in some very specific setups, which are currently unexpected in other ways (for example, recursive
AHashMapaccess?).Anyway, if you manage to find out more, let me know!
xana43 commentedon Oct 24, 2025
I did find out something else that I think it relevant to this issue. When I change the order of when my classes are registered, the part of the code that it fails on changes. in my prior setup when I first found this, I had a class that represented my options menu registered after the sub-components of said option menu.
I moved it to be registered before the other options (as the new implementation is AHashMap I thought that order would play a role in this) but now instead of it crashing when it's trying to load UI, it's crashing when it's trying to load a character within my game (in this case it's a test enemy in 2D) and it always happens when the scene tree is sending out the "tree_entered" signal to all nodes (it's also trying to open up multiple scenes at once as it's trying to restore my last saved editor layout)
I am unsure still what is causing this issue, because nothing in any stack traces or anything is pointing to my singletons, or anything else besides nodes that load up when the scene is loaded in general. I have tried to set everything up the same way in reproduction projects. but nothing happens
I've tried making singletons, abstract classes that register the overridden functions in derived classes, multi-level inerhitance with some classes randomly being abstract, nothing happens. perhaps it might be due to the fact that in my main project like 5 scenes open at once. I can only assume this is a threading issue (assuming that opening scenes is a multi-threaded operation) because to me this feels like undefined behavior in some way shape or form
under a debugger, I have also determined a potential place for investigation, while the classDB is calling virtual funtions, repeatedly a function in AHashMap called
_lookup_pos_with_hashis called, putting a breakpoint and running it until it crashes indicates that for some reason,map_data, capacity, num_elementsare all empty, withmap_databeingNULLhowever, it's being de-referenced anyways at this point. It's not always null, there are multiple virtual functions that get called successfully, for some reason though it only seems to fail when a class inherits from a class marked as abstract. according to the data from the call to the virtual function_get_minimum_size()though the bindings, something happens (I can't debug this because the call across the bindings is an opaque pointer) once it gets over to the AHashMap implementation the key is nothing and the data is null.However debugging this using the godot source code as a reference and not the godot-cpp source code (I use CLion for debugging and it takes the current "project" that's open for debug symbols). There is a valid key within the AHashMap on the godot side, but for some reason I can't step through
ClassDB::get_virtual_func()so I am unsure if the virtual function macro present in control.h is even sending the right data.here's the reproduction project I've been trying to get working in case it helps
Reproduction project.zip
this might be the limits of what I can find, because every debugger I try can't really see what data is being sent between the bindings, the only thing I know is that. For classes not marked as abstract it works fine.
[-]Editor crashes due to AHashMap during gui setup[/-][+]Editor crashes due to AHashMap when calling virtual functions from classes that inherit from abstract classes[/+][-]Editor crashes due to AHashMap when calling virtual functions from classes that inherit from abstract classes[/-][+]Editor crashes when calling virtual functions from classes that inherit from abstract classes[/+]BenLubar commentedon Oct 25, 2025
Not by any means a "minimal" repro case, but there's a reproducible crash here:
https://git.lubar.me/ben/spy-cards/src/commit/8dd5cc94083ca786c134f642bdafebc28ab5187b/build.sh#L26
(where
godot-latestis the 4.6-dev2 Linux executable)Here's the stack trace: (
godot-devis the same engine commit built locally with debug symbols)some potentially useful variable values:
xana43 commentedon Oct 25, 2025
a few more bits of information that I've discovered while messing around some more. so I here's some of the example of what my set up looks like (in a way that I can disclose)
I have an abstract class named
Pawnthis contains all of the base code for living entities, it inherits CharacterBody2D and contains 2 virtual functions nameddamageandhealboth of these take areal_tfor the amount of health to add or remove, there's other methods that are bound as well but these are not important, the ones that are important are the virtrual functions and how they're registered (assuming I'm understanding the issue here)I have 2 divergent branches from this class (which is marked as an abstract class)
I have a class named
PartyMemberwhich is the player's characters (as i'm currently developing a 2D RPG game) scenes with this class function fine until I add a GDScript to it, this class doesn't override the virtual functions fromPawnas those are virtual functions with implementations (not a pure virtual) the only other thing of interest in this class is that it defined _set() _get() and _get_property_list() but these don't cause issues.when I add a GDScript to
PartyMemberI get this stack tracethis issue goes completely away when I remove the GDScript from this class
the other divergent tree that comes from
Pawnis NPCsit now goes
Pawn -> Npc -> EnemyNpcdoes actually override thedamage()function fromPawnbecause it's so generic I can share the implementation of this functionthis class also defines 2 more virtual functions that have a default implementation, not important here because
Enemydoesn't override thesewhen any scene with an
Enemypresent is opened, it causes a similar stack trace, erroring out at a gdvirtual##m_name##_call on the bindings. the same happens for my original issue, where there I have a class hierarchy like thishowever these crash without any GDScript attached to them at all.
I found an issue that seems to be somewhat related
godotengine/godot#106271
when I get the chance to I might copy these all into another project and see if it still has an issue
Ivorforce commentedon Oct 25, 2025
Thank you @xana43 and @BenLubar.
It appears you are both experiencing the issue:
AHashMap(ClassInfo::virtual_methods) is found in an invalid state whereelements != nullptrbutmap_data == nullptr. This leads tofindcrashing because it's dereferencing data that does not exist.I've looked at the source code, but cannot find a normal situation where I can see this happen.
Some ideas though:
Memory::alloc_staticreturnsnullptrwhen settingmap_data. This would be possible if the requested size is too large, but this should log an error before the crash (did you see any?).ClassDBis modified from two different threads. It seems not to be protected, but registering virtual methods is not expected to be done outside the main thread. Are either of you launching threads?ClassInfo::virtual_methodsis in, overridingelements. However,elementslooks to be a relatively normal pointer in @BenLubar's trace, so this may be unlikely.If i could reproduce the problem, I would probably attempt to place breakpoints into
bind_virtual_methodand see when and how it happens thatvirtual_methods'selementsis set to something other thannullptr, butmap_dataisn't.One observation: All three of you are using Linux. Perhaps this has something to do with a compiler or stdlib bug? This would be pretty obscure, but it's a possibility until someone reports the bug from another OS.
xana43 commentedon Oct 26, 2025
I've done some testing with other compilers, I haven't had the chance to set up a test on MSVC, but the problem still persists on Clang/LLVM. I am not launching any threads at all though so I'm unsure why it seems to be doing this.
I'd be willing to test on windows, but it'll take a while for that to be set up (I have a windows 10 VM, but it's a pain to install GCC on it)
it's unlikely, but there's also a non-zero chance that an update to glibc/glibc++ and/or the linux kernel may have changed something about the threading priorities (as the editor itself may be doing something like that)
xana43 commentedon Oct 26, 2025
I think it'd be useful to provide the pointer that I as well
since I use CLion's debugger I can provide a screenshot
before crash
after crash
the virtual lookup seems to be called twice when calling the function for the class, because according to the debugger, when the call to
_gdvirtual__get_minimum_size_callis dispatched there's 1 invocation that has valid hashmap data (the picture from before the segfault) but then at roughly the same time (or shortly thereafter) it gets called again on the same pointer (in this case it's the ```GraphicsPanel``) and that's the second picture, the hashmap data after it's called again.I've went through the scene these erroring classes are a part of using a text editor, there's only 1 instance of these classes, no GDScript attatched to them, and their thread groups have not changed.
When I add these offending classes to a scene that can still open as these classes don't appear in those scenes, it still crashes outright
not sure if this is useful, but this is the
thispointer of the control that causes the issuexana43 commentedon Oct 26, 2025
EDIT: this solution only seems to work some of the time, but not all of the time. after trying a few more times it broke again after compiling one more time. this might be a result of compiler entropy, but I still think it's interesting that this is breaking virtual functions registered through the bindings
I just stumbled upon another interesting bit of information while messing around with things. So I fixed the crashing with the options panel, but not with the enemy class.
previously I had a function that notified the entire tree that an option changed
this function (only consisting of those two lines) appeared in the header of the base
OptionPanelclass, as such I needed to includewhen I moved this function out of the header into a source file I also moved this function into said source file. This fixed all the issues I was having with this specific chain of inheritance. it might be due to
scene_tree.hpporwindow.hppalso containing the functionregister_virtuals()and because of how includes work, it was originally like thishowever, putting the two headers required for
get_tree()into the source file solved this issue. However the problem still remains with the enemy classxana43 commentedon Oct 28, 2025
as I final note pending more investigation. The only thing I can conclude now is that it has something to do with the amount of classes registered, I've recreated all the conditions that create the crash in a new project, same version of the compiler, same compiler flags that it compiles with for debug, same everything. the only thing that isn't the same is the amount of classes and abstract classes that are registered with the engine, my main project has about 70 classes in total and 8 abstract classes. I'll get to work on seeing if that's the case, if not then I have no clue
xana43 commentedon Nov 4, 2025
after tons and tons and tons of tinkering. I initially gave up on this issue and just decided to not worry about testing any code in the godot engine, but then after a few updates to my version of the linux kernel the issue seems to have been fixed. I will continue to monitor how things are going. but it feels like the issue was with the linux kernel, which appears to be fixed now.