Skip to content

Rainbow Comet v1.25 - advshading=0 might involve massive leak / OOM crash #5757

@sprunk

Description

@sprunk

LuaRules/Gadgets/map_texture_generator.lua seems not to handle lack of AdvMapShading gracefully:

Line
  36: local USE_SHADING_TEXTURE = (Spring.GetConfigInt("AdvMapShading") == 1)
 166: local splattex = USE_SHADING_TEXTURE and gl.CreateTexture(...) -- if advshading != 0, false rather than a handle
 304: glRenderToTexture(splattex, ...) -- not guarded by USE_SHADING_TEXTURE, passes the false instead of a handle

The result is that there's a report ( https://discord.com/channels/278805140708786177/432874986064052235/1516937332807307314 ) of somebody getting this kind of spam every few frames:

[t=00:01:04.659170][f=0000844] Error: [LuaRules::RunCallInTraceback] error=2 (LUA_ERRRUN) callin=DrawGenesis trace=[Internal Lua error: Call failure] [string "LuaRules/Gadgets/map_texture_generator.lua"]:98: [string "LuaRules/Gadgets/map_texture_generator.lua"]:304: bad argument #1 to 'glRenderToTexture' (string expected, got boolean)
[t=00:01:04.698627][f=0000845] Generated blank fulltex
[t=00:01:04.698649][f=0000845] Generated blank splattex
[t=00:01:04.699451][f=0000845] Diffuse shader created
[t=00:01:04.699463][f=0000845] DNTS shader created
[t=00:01:04.720488][f=0000846] Begin shader draw
[t=00:01:05.027347][f=0000855] FullTex rendered in: 307
[t=00:01:05.049667][f=0000856] Starting to render DNTS-splattex
[t=00:01:05.049729][f=0000856] Error: [LuaRules::RunCallInTraceback] error=2 (LUA_ERRRUN) callin=DrawGenesis trace=[Internal Lua error: Call failure] [string "LuaRules/Gadgets/map_texture_generator.lua"]:98: [string "LuaRules/Gadgets/map_texture_generator.lua"]:304: bad argument #1 to 'glRenderToTexture' (string expected, got boolean)
[t=00:01:05.089508][f=0000857] Generated blank fulltex
[t=00:01:05.089531][f=0000857] Generated blank splattex
[t=00:01:05.090436][f=0000857] Diffuse shader created
[t=00:01:05.090457][f=0000857] DNTS shader created
[t=00:01:05.117439][f=0000858] Begin shader draw
[t=00:01:05.433735][f=0000867] FullTex rendered in: 317
[t=00:01:05.455758][f=0000868] Starting to render DNTS-splattex

with an OOM crash at the end (probably handles and/or textures leaking every time it reaches line 304 and getting recreated over).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions