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

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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Yes a new issue would be better, this one was fixed by https://github.com/godotengine/godot/pull/74566.

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 [970459615]

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.

https://github.com/MikeSchulze/gdUnit4/pull/223

The second crash is the same as https://github.com/godotengine/godot/issues/74233 (and is fixed by https://github.com/godotengine/godot/pull/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 https://github.com/godotengine/godot/blob/013a45706897af989703b944c7cd5f4f58a6c060/drivers/gles3/storage/texture_storage.cpp#L834

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.