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

GLES3 Texture - malloc_consolidate(): invalid chunk size / corrupted size vs. prev_size in fastbins #74562

Closed
naturally-intelligent opened this issue Mar 7, 2023 · 16 comments · Fixed by #74566

Comments

@naturally-intelligent
Copy link

Godot version

4.0-stable and master

System information

Ubuntu 20.04 LTS

Issue description

When switching away from a certain scene for the second time, (after running from Godot a second time), I get this message, the game quits, and returns to editor:

corrupted size vs. prev_size in fastbins

Or, sometimes this message instead (at the same point):

malloc_consolidate(): invalid chunk size

Usually it happens after running the game once after opening the editor, quitting, then running again, then switching scenes, then the second time the scene switches, it crashes. (There is a third message I've seen, but it doesn't happen as often and I didn't copy it.) The same game does not crash in Godot 3.4/3.5, and although a lot of changes were done in the conversion, no new features/behaviors were added.

How do I debug this? I've tried --verbose and using a debug build, but all I get is the one line.

Also mentioned in this Q+A: https://godotengine.org/qa/148717/malloc_consolidate-invalid-corrupted-prev_size-fastbins

Steps to reproduce

Usually it happens after running the game once after opening the editor, switching scenes over and over, quitting, then running again, then switching scenes, then the second time it switches, it crashes.

Minimal reproduction project

First I would like help debugging this. Then I will try to create an MRP. It would take a lot of effort and I don't know if it would even end up reproducing it, so I'd like some advice first

@akien-mga
Copy link
Member

akien-mga commented Mar 7, 2023

How do I debug this? I've tried --verbose and using a debug build, but all I get is the one line.

Running the editor through gdb, you might be able to get a stacktrace. Make sure to make a build with debug symbols (dev_build=yes or debug_symbols=yes).

Otherwise building the editor with Address Sanitizer (use_asan=yes) might also add useful information (warning, this makes the build slowers, much bigger, and requries a lot of RAM to link).

@naturally-intelligent
Copy link
Author

naturally-intelligent commented Mar 7, 2023

I've tried through gdb. Not sure if this is helpful at all, but this was the console output:

user@user-prime:~/Engines/godot/cpp/bin$ gdb godot.linuxbsd.editor.dev.x86_64 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
Reading symbols from godot.linuxbsd.editor.dev.x86_64...
(gdb) run
Starting program: /home/user/Engines/godot/cpp/bin/godot.linuxbsd.editor.dev.x86_64 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 1167000]
[New Thread 0x7ffff731a700 (LWP 1167007)]
[New Thread 0x7ffff6b19700 (LWP 1167011)]
[New Thread 0x7ffff6318700 (LWP 1167012)]
[New Thread 0x7ffff5b17700 (LWP 1167013)]
[New Thread 0x7ffff5316700 (LWP 1167014)]
[New Thread 0x7ffff4b15700 (LWP 1167015)]
[New Thread 0x7ffff4314700 (LWP 1167016)]
[New Thread 0x7ffff3b13700 (LWP 1167017)]
[New Thread 0x7ffff3312700 (LWP 1167018)]
Godot Engine v4.1.dev.custom_build.31eccb550 - https://godotengine.org
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_utf32_to_keysym
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_keymap_key_get_mods_for_level
[New Thread 0x7ffff22c2700 (LWP 1167031)]
[Detaching after fork from child process 1167032]
[Detaching after fork from child process 1167036]
[Thread 0x7ffff22c2700 (LWP 1167031) exited]
[Detaching after fork from child process 1167039]
[New Thread 0x7ffff0b38700 (LWP 1167055)]
OpenGL API 3.3.0 NVIDIA 515.48.07 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 960
[New Thread 0x7fffe9ac5700 (LWP 1167061)]
[New Thread 0x7fffe92c4700 (LWP 1167062)]
[New Thread 0x7fffd3fff700 (LWP 1167063)]
 
[New Thread 0x7fffd37fe700 (LWP 1167087)]
Editing project: /home/user/Games/fhc/fhc4
[Detaching after fork from child process 1167759]
Godot Engine v4.1.dev.custom_build.31eccb550 - https://godotengine.org
[Thread 0x7fffd37fe700 (LWP 1167087) exited]
[Thread 0x7fffd3fff700 (LWP 1167063) exited]
[Thread 0x7fffe92c4700 (LWP 1167062) exited]
[Thread 0x7fffe9ac5700 (LWP 1167061) exited]
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_utf32_to_keysym
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_keymap_key_get_mods_for_level
[Thread 0x7ffff0b38700 (LWP 1167055) exited]
[Thread 0x7ffff3312700 (LWP 1167018) exited]
[Thread 0x7ffff3b13700 (LWP 1167017) exited]
[Thread 0x7ffff4314700 (LWP 1167016) exited]
[Thread 0x7ffff4b15700 (LWP 1167015) exited]
[Thread 0x7ffff5316700 (LWP 1167014) exited]
[Thread 0x7ffff5b17700 (LWP 1167013) exited]
[Thread 0x7ffff6318700 (LWP 1167012) exited]
[Thread 0x7ffff6b19700 (LWP 1167011) exited]
[Thread 0x7ffff731a700 (LWP 1167007) exited]
[Inferior 1 (process 1166961) exited normally]
(gdb) OpenGL API 3.3.0 NVIDIA 515.48.07 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 960
 
WARNING: Glow is not supported when using the GL Compatibility backend yet. Support will be added in a future release.
     at: environment_set_glow (servers/rendering/storage/environment_storage.cpp:387)
Running: /home/user/Engines/godot/cpp/bin/godot.linuxbsd.editor.dev.x86_64 --path /home/user/Games/fhc/svn/godot-4 --remote-debug tcp://127.0.0.1:6007 --editor-pid 1167759 --position 2560,360 --breakpoints res://core/weapons/grabber.gd:64 res://menus/launch.tscn
Godot Engine v4.1.dev.custom_build.31eccb550 - https://godotengine.org
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_utf32_to_keysym
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_keymap_key_get_mods_for_level
OpenGL API 3.3.0 NVIDIA 515.48.07 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 960

DEV MODE ENABLED
---
ERROR: Timer was not added to the SceneTree. Either add it or set autostart to true.
   at: start (scene/main/timer.cpp:109)
WARNING: Glow is not supported when using the GL Compatibility backend yet. Support will be added in a future release.
     at: environment_set_glow (servers/rendering/storage/environment_storage.cpp:387)
quit
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/templates/self_list.h:106)
ERROR: 1 RID allocations of type 'N26RendererEnvironmentStorage11EnvironmentE' were leaked at exit.
Running: /home/user/Engines/godot/cpp/bin/godot.linuxbsd.editor.dev.x86_64 --path /home/user/Games/fhc/svn/godot-4 --remote-debug tcp://127.0.0.1:6007 --editor-pid 1167759 --position 2560,360 --breakpoints res://core/weapons/grabber.gd:64 res://menus/launch.tscn
Godot Engine v4.1.dev.custom_build.31eccb550 - https://godotengine.org
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_utf32_to_keysym
/lib/x86_64-linux-gnu/libxkbcommon.so.0: undefined symbol: xkb_keymap_key_get_mods_for_level
OpenGL API 3.3.0 NVIDIA 515.48.07 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 960
 
DEV MODE ENABLED
---
ERROR: Timer was not added to the SceneTree. Either add it or set autostart to true.
   at: start (scene/main/timer.cpp:109)
WARNING: Glow is not supported when using the GL Compatibility backend yet. Support will be added in a future release.
     at: environment_set_glow (servers/rendering/storage/environment_storage.cpp:387)
malloc_consolidate(): invalid chunk size

As you can see, the message is quite bland. I'm not sure if I'll be able to build with Address Sanitizer on this computer, the dev build was strainful enough. But I'll look into it

@akien-mga
Copy link
Member

You should run a project directly with gdb, here you likely ran the project manager, and then lost the handle on the process when editing a project. Run it with run -e --path path/to/project.

@naturally-intelligent
Copy link
Author

Thanks, I was wondering about that...

Some more info from "bt" after a crash:

corrupted size vs. prev_size in fastbins

Thread 1 "godot.linuxbsd." received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7c5a859 in __GI_abort () at abort.c:79
#2  0x00007ffff7cc526e in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7def298 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007ffff7ccd2fc in malloc_printerr (str=str@entry=0x7ffff7df12a8 "corrupted size vs. prev_size in fastbins") at malloc.c:5347
#4  0x00007ffff7ccdacc in malloc_consolidate (av=av@entry=0x7ffff7e24b80 <main_arena>) at malloc.c:4493
#5  0x00007ffff7ccefe0 in _int_free (av=0x7ffff7e24b80 <main_arena>, p=0x55556a3f0540, have_lock=<optimized out>) at malloc.c:4400
#6  0x00007fffea97e103 in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#7  0x00007fffea64f8bb in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#8  0x00007fffeaa3677c in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#9  0x00007fffea742c70 in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#10 0x00007fffeaa3820c in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#11 0x00007fffea70b40b in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.515.48.07
#12 0x00005555595f78ee in GLES3::TextureStorage::texture_free (this=0x5555614b8d70, p_texture=...) at drivers/gles3/storage/texture_storage.cpp:709
#13 0x0000555559608325 in GLES3::Utilities::free (this=0x555561a013b0, p_rid=...) at drivers/gles3/storage/utilities.cpp:124
#14 0x000055555bf8a8d3 in RenderingServerDefault::_free (this=0x555561996740, p_rid=...) at servers/rendering/rendering_server_default.cpp:51
#15 0x000055555bfa5d8b in RenderingServerDefault::free (this=0x555561996740, p_rid=...) at servers/rendering/rendering_server_default.h:955
#16 0x000055555b8bde5b in CompressedTexture2D::~CompressedTexture2D (this=0x5555685446f0, __in_chrg=<optimized out>) at scene/resources/texture.cpp:1079
#17 0x0000555557ce6ce2 in memdelete<Texture2D> (p_class=0x5555685446f0) at ./core/os/memory.h:109
#18 0x0000555557ce2daa in Ref<Texture2D>::unref (this=0x555568799ff0) at ./core/object/ref_counted.h:221
#19 0x0000555557cdd962 in Ref<Texture2D>::~Ref (this=0x555568799ff0, __in_chrg=<optimized out>) at ./core/object/ref_counted.h:233
#20 0x000055555b33315e in Sprite2D::~Sprite2D (this=0x555568799af0, __in_chrg=<optimized out>) at scene/2d/sprite_2d.cpp:458
#21 0x0000555558230859 in memdelete<Node> (p_class=0x555568799af0) at ./core/os/memory.h:109
#22 0x000055555aa3b86a in Node::_notification (this=0x55556a3c3c90, p_notification=1) at scene/main/node.cpp:170
#23 0x0000555557f1a028 in Node::_notificationv (this=0x55556a3c3c90, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#24 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a3c3c90, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#25 0x000055555b1c7bbd in Node2D::_notificationv (this=0x55556a3c3c90, p_notification=1, p_reversed=true) at ./scene/2d/node_2d.h:37
#26 0x000055555cd60fa5 in Object::notification (this=0x55556a3c3c90, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#27 0x000055555cd5e761 in Object::_predelete (this=0x55556a3c3c90) at core/object/object.cpp:196
#28 0x000055555cd6b807 in predelete_handler (p_object=0x55556a3c3c90) at core/object/object.cpp:1825
#29 0x0000555558230839 in memdelete<Node> (p_class=0x55556a3c3c90) at ./core/os/memory.h:105
#30 0x000055555aa3b86a in Node::_notification (this=0x55556a5d7fa0, p_notification=1) at scene/main/node.cpp:170
#31 0x0000555557f1a028 in Node::_notificationv (this=0x55556a5d7fa0, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#32 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a5d7fa0, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#33 0x0000555558683447 in Control::_notificationv (this=0x55556a5d7fa0, p_notification=1, p_reversed=true) at ./scene/gui/control.h:47
#34 0x000055555cd60fa5 in Object::notification (this=0x55556a5d7fa0, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#35 0x000055555cd5e761 in Object::_predelete (this=0x55556a5d7fa0) at core/object/object.cpp:196
#36 0x000055555cd6b807 in predelete_handler (p_object=0x55556a5d7fa0) at core/object/object.cpp:1825
#37 0x0000555558230839 in memdelete<Node> (p_class=0x55556a5d7fa0) at ./core/os/memory.h:105
#38 0x000055555aa3b86a in Node::_notification (this=0x55556a383f60, p_notification=1) at scene/main/node.cpp:170
#39 0x0000555557f1a028 in Node::_notificationv (this=0x55556a383f60, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#40 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a383f60, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#41 0x000055555b1c7bbd in Node2D::_notificationv (this=0x55556a383f60, p_notification=1, p_reversed=true) at ./scene/2d/node_2d.h:37
#42 0x000055555b333c51 in Sprite2D::_notificationv (this=0x55556a383f60, p_notification=1, p_reversed=true) at scene/2d/sprite_2d.h:38
#43 0x000055555cd60fa5 in Object::notification (this=0x55556a383f60, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#44 0x000055555cd5e761 in Object::_predelete (this=0x55556a383f60) at core/object/object.cpp:196
#45 0x000055555cd6b807 in predelete_handler (p_object=0x55556a383f60) at core/object/object.cpp:1825
#46 0x0000555558230839 in memdelete<Node> (p_class=0x55556a383f60) at ./core/os/memory.h:105
#47 0x000055555aa3b86a in Node::_notification (this=0x555568801070, p_notification=1) at scene/main/node.cpp:170
#48 0x0000555557f1a028 in Node::_notificationv (this=0x555568801070, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#49 0x0000555558682a63 in CanvasItem::_notificationv (this=0x555568801070, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#50 0x0000555558683447 in Control::_notificationv (this=0x555568801070, p_notification=1, p_reversed=true) at ./scene/gui/control.h:47
#51 0x000055555cd60fa5 in Object::notification (this=0x555568801070, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#52 0x000055555cd5e761 in Object::_predelete (this=0x555568801070) at core/object/object.cpp:196
#53 0x000055555cd6b807 in predelete_handler (p_object=0x555568801070) at core/object/object.cpp:1825
#54 0x0000555557d392b4 in memdelete<Object> (p_class=0x555568801070) at ./core/os/memory.h:105
#55 0x000055555aa7de22 in SceneTree::_flush_delete_queue (this=0x5555634991c0) at scene/main/scene_tree.cpp:1063
#56 0x000055555aa7af56 in SceneTree::process (this=0x5555634991c0, p_time=0.016666666666666666) at scene/main/scene_tree.cpp:474
#57 0x0000555557d31643 in Main::iteration () at main/main.cpp:3161
#58 0x0000555557caba0c in OS_LinuxBSD::run (this=0x7fffffffd9e0) at platform/linuxbsd/os_linuxbsd.cpp:880
#59 0x0000555557ca252c in main (argc=4, argv=0x7fffffffdf08) at platform/linuxbsd/godot_linuxbsd.cpp:73

@naturally-intelligent
Copy link
Author

Another crash, in same spot in game:

double free or corruption (fasttop)

Thread 1 "godot.linuxbsd." received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7c5a859 in __GI_abort () at abort.c:79
#2  0x00007ffff7cc526e in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7def298 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007ffff7ccd2fc in malloc_printerr (str=str@entry=0x7ffff7df1628 "double free or corruption (fasttop)") at malloc.c:5347
#4  0x00007ffff7ccec65 in _int_free (av=0x7ffff7e24b80 <main_arena>, p=0x555566617e60, have_lock=0) at malloc.c:4266
#5  0x000055555c735189 in Memory::free_static (p_ptr=0x555566617e80, p_pad_align=false) at core/os/memory.cpp:168
#6  0x00005555596014b5 in memdelete<GLES3::CanvasTexture> (p_class=0x555566617e80) at ./core/os/memory.h:112
#7  0x00005555595f78bb in GLES3::TextureStorage::texture_free (this=0x5555614b8df0, p_texture=...) at drivers/gles3/storage/texture_storage.cpp:704
#8  0x0000555559608325 in GLES3::Utilities::free (this=0x555561a00c30, p_rid=...) at drivers/gles3/storage/utilities.cpp:124
#9  0x000055555bf8a8d3 in RenderingServerDefault::_free (this=0x555561995f70, p_rid=...) at servers/rendering/rendering_server_default.cpp:51
#10 0x000055555bfa5d8b in RenderingServerDefault::free (this=0x555561995f70, p_rid=...) at servers/rendering/rendering_server_default.h:955
#11 0x000055555b8bde5b in CompressedTexture2D::~CompressedTexture2D (this=0x55556aff9500, __in_chrg=<optimized out>) at scene/resources/texture.cpp:1079
#12 0x0000555557ce6ce2 in memdelete<Texture2D> (p_class=0x55556aff9500) at ./core/os/memory.h:109
#13 0x0000555557ce2daa in Ref<Texture2D>::unref (this=0x55556a377d68) at ./core/object/ref_counted.h:221
#14 0x0000555557cdd962 in Ref<Texture2D>::~Ref (this=0x55556a377d68, __in_chrg=<optimized out>) at ./core/object/ref_counted.h:233
#15 0x000055555b8e6364 in AnimatedTexture::Frame::~Frame (this=0x55556a377d68, __in_chrg=<optimized out>) at scene/resources/texture.h:910
#16 0x000055555b8cf5b7 in AnimatedTexture::~AnimatedTexture (this=0x55556a377a10, __in_chrg=<optimized out>) at scene/resources/texture.cpp:2816
#17 0x0000555557ce6ce2 in memdelete<Texture2D> (p_class=0x55556a377a10) at ./core/os/memory.h:109
#18 0x0000555557ce2daa in Ref<Texture2D>::unref (this=0x55556a35b840) at ./core/object/ref_counted.h:221
#19 0x0000555557cdd962 in Ref<Texture2D>::~Ref (this=0x55556a35b840, __in_chrg=<optimized out>) at ./core/object/ref_counted.h:233
#20 0x000055555b27f04a in Line2D::~Line2D (this=0x55556a35b300, __in_chrg=<optimized out>) at scene/2d/line_2d.h:36
#21 0x0000555558230859 in memdelete<Node> (p_class=0x55556a35b300) at ./core/os/memory.h:109
#22 0x000055555aa3b86a in Node::_notification (this=0x555568841c50, p_notification=1) at scene/main/node.cpp:170
#23 0x0000555557f1a028 in Node::_notificationv (this=0x555568841c50, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#24 0x0000555558682a63 in CanvasItem::_notificationv (this=0x555568841c50, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#25 0x000055555b1c7bbd in Node2D::_notificationv (this=0x555568841c50, p_notification=1, p_reversed=true) at ./scene/2d/node_2d.h:37
#26 0x000055555cd60fa5 in Object::notification (this=0x555568841c50, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#27 0x000055555cd5e761 in Object::_predelete (this=0x555568841c50) at core/object/object.cpp:196
#28 0x000055555cd6b807 in predelete_handler (p_object=0x555568841c50) at core/object/object.cpp:1825
#29 0x0000555558230839 in memdelete<Node> (p_class=0x555568841c50) at ./core/os/memory.h:105
#30 0x000055555aa3b86a in Node::_notification (this=0x55556a30c4a0, p_notification=1) at scene/main/node.cpp:170
#31 0x0000555557f1a028 in Node::_notificationv (this=0x55556a30c4a0, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#32 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a30c4a0, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#33 0x000055555b1c7bbd in Node2D::_notificationv (this=0x55556a30c4a0, p_notification=1, p_reversed=true) at ./scene/2d/node_2d.h:37
#34 0x000055555cd60fa5 in Object::notification (this=0x55556a30c4a0, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#35 0x000055555cd5e761 in Object::_predelete (this=0x55556a30c4a0) at core/object/object.cpp:196
#36 0x000055555cd6b807 in predelete_handler (p_object=0x55556a30c4a0) at core/object/object.cpp:1825
#37 0x0000555558230839 in memdelete<Node> (p_class=0x55556a30c4a0) at ./core/os/memory.h:105
#38 0x000055555aa3b86a in Node::_notification (this=0x55556a5e0760, p_notification=1) at scene/main/node.cpp:170
#39 0x0000555557f1a028 in Node::_notificationv (this=0x55556a5e0760, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#40 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a5e0760, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#41 0x0000555558683447 in Control::_notificationv (this=0x55556a5e0760, p_notification=1, p_reversed=true) at ./scene/gui/control.h:47
#42 0x000055555cd60fa5 in Object::notification (this=0x55556a5e0760, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#43 0x000055555cd5e761 in Object::_predelete (this=0x55556a5e0760) at core/object/object.cpp:196
#44 0x000055555cd6b807 in predelete_handler (p_object=0x55556a5e0760) at core/object/object.cpp:1825
#45 0x0000555558230839 in memdelete<Node> (p_class=0x55556a5e0760) at ./core/os/memory.h:105
#46 0x000055555aa3b86a in Node::_notification (this=0x55556a5fa130, p_notification=1) at scene/main/node.cpp:170
#47 0x0000555557f1a028 in Node::_notificationv (this=0x55556a5fa130, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#48 0x0000555558682a63 in CanvasItem::_notificationv (this=0x55556a5fa130, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#49 0x000055555b1c7bbd in Node2D::_notificationv (this=0x55556a5fa130, p_notification=1, p_reversed=true) at ./scene/2d/node_2d.h:37
#50 0x000055555b333c51 in Sprite2D::_notificationv (this=0x55556a5fa130, p_notification=1, p_reversed=true) at scene/2d/sprite_2d.h:38
#51 0x000055555cd60fa5 in Object::notification (this=0x55556a5fa130, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#52 0x000055555cd5e761 in Object::_predelete (this=0x55556a5fa130) at core/object/object.cpp:196
#53 0x000055555cd6b807 in predelete_handler (p_object=0x55556a5fa130) at core/object/object.cpp:1825
#54 0x0000555558230839 in memdelete<Node> (p_class=0x55556a5fa130) at ./core/os/memory.h:105
#55 0x000055555aa3b86a in Node::_notification (this=0x555568669000, p_notification=1) at scene/main/node.cpp:170
#56 0x0000555557f1a028 in Node::_notificationv (this=0x555568669000, p_notification=1, p_reversed=true) at ./scene/main/node.h:46
#57 0x0000555558682a63 in CanvasItem::_notificationv (this=0x555568669000, p_notification=1, p_reversed=true) at ./scene/main/canvas_item.h:45
#58 0x0000555558683447 in Control::_notificationv (this=0x555568669000, p_notification=1, p_reversed=true) at ./scene/gui/control.h:47
#59 0x000055555cd60fa5 in Object::notification (this=0x555568669000, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#60 0x000055555cd5e761 in Object::_predelete (this=0x555568669000) at core/object/object.cpp:196
#61 0x000055555cd6b807 in predelete_handler (p_object=0x555568669000) at core/object/object.cpp:1825
#62 0x0000555557d392b4 in memdelete<Object> (p_class=0x555568669000) at ./core/os/memory.h:105
#63 0x000055555aa7de22 in SceneTree::_flush_delete_queue (this=0x55556349af90) at scene/main/scene_tree.cpp:1063
#64 0x000055555aa7af56 in SceneTree::process (this=0x55556349af90, p_time=0.016666666666666666) at scene/main/scene_tree.cpp:474
#65 0x0000555557d31643 in Main::iteration () at main/main.cpp:3161
#66 0x0000555557caba0c in OS_LinuxBSD::run (this=0x7fffffffd9e0) at platform/linuxbsd/os_linuxbsd.cpp:880
#67 0x0000555557ca252c in main (argc=4, argv=0x7fffffffdf08) at platform/linuxbsd/godot_linuxbsd.cpp:73

@clayjohn
Copy link
Member

clayjohn commented Mar 7, 2023

The second crash is the same as #74233 (and is fixed by #74566), but the first one is in a slightly different spot.

Can you try adding the follow two lines to texture_proxy_update:

tex->canvas_texture = nullptr;
tex->tex_id = 0;

They should be added right after

tex->proxies.clear();

@naturally-intelligent
Copy link
Author

Thanks @clayjohn

I rebuilt from master with those two lines added. I've tested half a dozen times and the crashes cannot be reproduced now!

@naturally-intelligent naturally-intelligent changed the title malloc_consolidate(): invalid chunk size / corrupted size vs. prev_size in fastbins GLES3 Texture - malloc_consolidate(): invalid chunk size / corrupted size vs. prev_size in fastbins Mar 7, 2023
@MikeSchulze
Copy link

MikeSchulze commented Jul 8, 2023

I'm not surre it is the same error, but it crashes now on my ci-pr workflow
i run my tests by cmd
xvfb-run --auto-servernum ./addons/gdUnit4/runtest.sh --add ${{ inputs.test-includes }} --audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0 --continue --verbose

It works on Godot 4.0.1, 4.0.2 and 4.0.3 but fails now on v4.1.stable.official [9704596]

running on ubuntu-latest

Total test suites: 90
Total test cases:  1142
Total time:        3min 40s 913ms
Open Report at: file:///home/runner/work/gdUnit4/gdUnit4/reports/report_1/index.html
Exit code: 0
corrupted size vs. prev_size while consolidating
Aborted (core dumped)
Error: Process completed with exit code 134.

MikeSchulze/gdUnit4#223

@naturally-intelligent
Copy link
Author

@MikeSchulze Oh god no... Hopefully this isn't the same error! I haven't experienced it with 4.1 but I know what a nightmare it is when it starts occurring. You'll have to create a dev build of godot and debug with gdb to get a track stace.

@MikeSchulze
Copy link

@MikeSchulze Oh god no... Hopefully this isn't the same error! I haven't experienced it with 4.1 but I know what a nightmare it is when it starts occurring. You'll have to create a dev build of godot and debug with gdb to get a track stace.

no i use the godot built from https://downloads.tuxfamily.org/godotengine/4.1/
I searched for instruction to get the crash dump, but i can't finde one

@naturally-intelligent
Copy link
Author

no i use the godot built from https://downloads.tuxfamily.org/godotengine/4.1/ I searched for instruction to get the crash dump, but i can't finde one

To debug it you'd need to build your own Godot from source with dev flag on, then run it through GDB. Sorry it's not fun and the dev build is close to 1GB. But that's the only way I know how to get the stack trace.

https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_linuxbsd.html

Plus the instructions at the top of this thread...

@MikeSchulze
Copy link

I will give a try tomorrow, feel free to fork my repo too ;)

@MikeSchulze
Copy link

I actually don't have time to go deeper here as I am working on the C# API for this right now .
I ran the test on my Mac this morning and see these errors.

at runtime, a lot of

ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:111)
ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:111)
ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:111)
ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:111)
...   
ERROR: Cubemap Arrays are not supported in the GL Compatibility backend.
   at: texture_2d_layered_initialize (drivers/gles3/storage/texture_storage.cpp:763)
ERROR: Cubemap Arrays are not supported in the GL Compatibility backend.
   at: texture_2d_layered_initialize (drivers/gles3/storage/texture_storage.cpp:763)
ERROR: Attempting to use an uninitialized RID
   at: get_or_null (./core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: texture_free (drivers/gles3/storage/texture_storage.cpp:705)

at cleanup

ERROR: Attempting to use an uninitialized RID
   at: get_or_null (./core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: texture_free (drivers/gles3/storage/texture_storage.cpp:705)

here a simple project to reproduce the error
malloc_texture.zip
Run it with $GODOT_BIN --path . -s -d res://test.gd --audio-driver Dummy --rendering-driver opengl3 --continue
shows

 malloc_texture $GODOT_BIN --path . -s -d res://test.gd --audio-driver Dummy --rendering-driver opengl3 --continue
Godot Engine v4.1.stable.official.970459615 - https://godotengine.org
OpenGL API 4.1 ATI-4.4.17 - Compatibility - Using Device: ATI Technologies Inc. - AMD Radeon Pro 5300M OpenGL Engine
 
run test
ERROR: Condition "!texture_allocs_cache.has(p_id)" is true.
   at: texture_free_data (drivers/gles3/storage/utilities.h:111)
Finallize ..
-Orphan nodes report-----------------------
-SceneTree report-----------------------
 ┖╴root
Finallize .. done

@naturally-intelligent
Copy link
Author

I'll re-open this issue, although I do recommend making a new issue with your project so that it gets proper attention

@MikeSchulze
Copy link

hi @naturally-intelligent no problem i can create a new issue if you want, and link this issue.

@akien-mga
Copy link
Member

Yes a new issue would be better, this one was fixed by #74566.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants