Zylann / voxelgame

Voxel world prototype made with Godot Engine
Other
513 stars 84 forks source link

ERROR: RID_Owner<struct RasterizerSceneGLES3::LightInstance>::getornull: Condition "!id_map.has(p_rid.get_data())" is true. Returned: 0 #71

Open Zylann opened 3 years ago

Zylann commented 3 years ago

When using the rocket launcher to blow stuff up, causing explosions with an OmniLight in each of them, at some point, this error starts to spam:

ERROR: RID_Owner<struct RasterizerSceneGLES3::LightInstance>::getornull: Condition "!id_map.has(p_rid.get_data())" is true. Returned: 0

The rate at which it happens is random, I can be blowing stuff up for 10 seconds, 1 minute or 5 minutes until it starts happening. The game continues to work fine, although I'm in a debug build, which means this could have caused a crash. It also causes a lot of lag due to the logspam.

In the engine, it happens in RasterizerSceneGLES3::_setup_light. From what I assume looking at the code, the renderer is trying to setup OmniLights and SpotLights affecting a mesh before drawing it. There is 1 light RID attached on the mesh, however the light cannot be found in id_map (explosions auto-destroy after 3 seconds). A possible cause would be the light got destroyed, without updating this list. So the game ends up with meshes having dangling light RIDs attached to them, and never go away. When the camera looks at them, spamming occurs.

But I have zero clue as to how this happens in the first place. I tried reproducing in a small test scene, to no avail, of course. Trying to debug this is really difficult because the only reproduction case I have involves tons of objects in the scene...


[08:59:08] <lawnjelly> Zylann: That could possibly be due to the leak in octree, and the pairing. you could try naithar or my fixed versions.
[08:59:30] <lawnjelly> #41123
[08:59:31] <IssueBot> #41123: [WIP] Optimize octree and fix leak | https://git.io/JJ1Ip
[08:59:45] <lawnjelly> #41122
[08:59:45] <IssueBot> #41122: [3.2] Octree's octant invalidation/removing | https://git.io/JJ1Ib
[09:00:16] <lawnjelly> That's just a hunch though. Could be multiple possible references being dangled.
PhilipWee commented 3 years ago

Yo, we are having the same issue in our game, any ideas on how we might fix it?

Zylann commented 3 years ago

Take a look at https://github.com/godotengine/godot/issues/41360