Closed akien-mga closed 12 months ago
With template_release
build on macOS, I'm getting a lot of ERROR: Condition "slot >= slot_max" is true. Returning: nullptr
messages (but not endless spam) and no crash.
With
template_release
build on macOS, I'm getting a lot ofERROR: Condition "slot >= slot_max" is true. Returning: nullptr
messages (but not endless spam) and no crash.
Same for me on Windows (MSVC if that's important again).
Edit: By the way, added a custom message so there is at least some information in release builds, and the overflow is pretty impressive:
ERROR: Cannot get instance from ObjectDB, slot index 8957152 (id: 1254273625312) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 8957152 (id: 1254273625312) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 15307384 (id: -8646787037943721352) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 15307384 (id: -8646787037943721352) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 9782608 (id: 1254274450768) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 9782608 (id: 1254274450768) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 8776596 (id: -8646601220619375724) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
ERROR: Cannot get instance from ObjectDB, slot index 8776596 (id: -8646601220619375724) is exceeding max 2048
at: (C:\Projects\godot-engine\master\core/object/object.h:1034)
Edit2: Actually, what the hell? How is id printed here, which is supposed to be a uint64 value, negative? Or is this just a bug/limitation with vformat?
overflow is pretty impressive
It likely just random garbage from corrupted memory, the issue should be in the CallQueue
.
Actually, what the hell? How is id printed here, which is supposed to be a uint64 value, negative?
GDScript int (and therefore vformat) is always signed 64-bit int.
The issues seem to be not in the CallQueue
, but in the CallableCustomMethodPointer
:
CallableCustomMethodPointer
store only a raw pointer to the object, and if this object freed during CallQueue
flush, subsequent Callable processing is causing read-after-free when it's trying to get ObjectID from this pointer.CallableCustomMethodPointer
store ObjectID directly, so it's not an issue, queue just ignore calls if it can't get ID.
Godot version
4.2.rc2 (ad72de508363ca8d10c6b148be44a02cdf12be13)
System information
Mageia 9 - Vulkan (Forward+) - dedicated AMD Radeon RX Vega M GL Graphics (RADV VEGAM) () - Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz (8 Threads)
Issue description
Spin-off from #70910, where the MRP from https://github.com/godotengine/godot/issues/70910#issuecomment-1758935677 seems to trigger a segfault (on Linux with GCC at least), but only with 4.2 builds, so it appears to be a regression of some sort.
The crash is reproduced when compiling Godot with
scons p=linuxbsd target=template_release
, to whichdebug_symbols=yes
can be added to have a nice stacktrace.Here's the log output and stacktrace:
The main problem seems to be the optimization level.
With
target=template_release
, the default optimization level isoptimize=speed_trace
, which for GCC sets-O2
.I tested a custom build with
-O1
(optimize=debug CCFLAGS=-O1
), which also reproduces the bug. That gives slightly more info in the stacktrace:With
-O0
(optimize=none
, oroptimize=custom CCFLAGS=-O0
), there's no crash, just endless error spam like in #70910.Steps to reproduce
return
line inControl.gd
as advised by the scripttemplate_release
binary, compiled withscons p=linuxbsd target=template_release debug_symbols=yes
or equivalentMinimal reproduction project
Freebug.zip