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

Attempted to free invalid ID Errors from running project. #90452

Closed
chrisl8 opened this issue Apr 9, 2024 · 2 comments · Fixed by #90458
Closed

Attempted to free invalid ID Errors from running project. #90452

chrisl8 opened this issue Apr 9, 2024 · 2 comments · Fixed by #90458

Comments

@chrisl8
Copy link
Contributor

chrisl8 commented Apr 9, 2024

Tested versions

v4.3.dev.custom_build [6c57928]

Does not occur with 4.2.1 Stable

System information

Godot v4.3.dev (a7b8602) - Windows 10.0.22621 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3080 Ti (NVIDIA; 31.0.15.5186) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

Regular errors when running the Large World Coordinates Demo Project:

ERROR: Attempted to free invalid ID: 616542555348694
   at: RenderingDevice::_free_internal (servers\rendering\rendering_device.cpp:4609)
ERROR: Attempted to free invalid ID: 616555440250584
   at: RenderingDevice::_free_internal (servers\rendering\rendering_device.cpp:4609)
ERROR: Attempted to free invalid ID: 616568325152474
   at: RenderingDevice::_free_internal (servers\rendering\rendering_device.cpp:4609)
ERROR: Attempted to free invalid ID: 616581210054364
   at: RenderingDevice::_free_internal (servers\rendering\rendering_device.cpp:4609)

Steps to reproduce

Open the Large World Coordinates Demo Project
Open the Output Window
Run/Play it.
Switch between the editor and running game screen a few times can spur them on.
Also switch between the Output and Debugger view.
Then close it and these errors appear, sometimes repeatedly.

Minimal reproduction project (MRP)

Use the Large World Coordinates Demo Project

Bisect Results

dfa326e is the first bad commit
commit dfa326e
Merged in #89531 70c05f6
Author: @sullyscience
Date: Thu Mar 14 16:07:44 2024 -0400

Fix: Address mobile resource leaks in render

Update render_forward_mobile destructor to include instance buffers.
Update render_scene_buffers_rd cleanup to include weight buffers / blur
textures.

.../rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp | 5 +++++
.../rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp | 7 +++++++
2 files changed, 12 insertions(+)

@akien-mga
Copy link
Member

Linking the PR: #89531
CC @clayjohn @BastiaanOlij

@BastiaanOlij
Copy link
Contributor

I think what might be missing here is that after we free the buffer (RD::get_singleton()->free(weight_buffer.weight)), we don't clear the RID, meaning it will try and free it again later only to give the error that it has already been freed.
Usually not a problem when done in a destructor, but in a function like cleanup that is also called when buffers have to be recreated, it causes issues.

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