Facepunch / garrysmod-issues

Garry's Mod issue tracker
141 stars 56 forks source link

Crash on clients on changelevel #5917

Open BlackhawkGT opened 3 months ago

BlackhawkGT commented 3 months ago

Details

Crash Dump 1: http://dothefunny.com/ziddy/dumps/41e2f0c3-c020-45cc-96b3-4e5ab5882f22.dmp Crash Dump 1 TXT: http://dothefunny.com/ziddy/dumps/41e2f0c3-c020-45cc-96b3-4e5ab5882f22.txt Crash Dump 2: http://dothefunny.com/ziddy/dumps/49493bc7-4167-49ac-bc35-0122865ebb25.dmp Crash Dump 2 TXT: http://dothefunny.com/ziddy/dumps/49493bc7-4167-49ac-bc35-0122865ebb25.txt

Steps to reproduce

It always crashes randomly during changelevel but it's so random I have no idea how to reproduce it. No error, it just closes and the console log shows nothing either other than it unmounting workshop addons from the server before changing the map and it ending with:

Zombie Survival Map: zs_placid_final Players: 19 / 64 Build: 9246 Server Number: 7

Happens without 64 bit as well.

robotboy655 commented 2 months ago

Please upload the dumps as a .zip directly to GitHub.

Please clarify what you mean by "Happens without 64 bit as well." - Do you mean that NONE beta also crashes?

BlackhawkGT commented 2 months ago

dumps.zip

Yeah, sorry. I forgot to fully clarify that this also happens on the none beta branch, though admittedly I only got this told by people who join the server so I'll probably have to ask for their crash dump too or try to produce it on my end myself. I only use the x86-64 branch at the moment.

robotboy655 commented 2 months ago

1) How often does it happen? 2) Any way to reproduce it? 3) What is the server where this happens? 4) Does it happen with gmod_uncache_test -1?

charitea commented 2 months ago

Had a similar issue on our sandbox server. Setting gmod_uncache_test to 1 on all clients fixed most, if not all crashes caused by the issue. If it helps, we can set gmod_uncache_test to 2 to see if players start experiencing the crash or not.

BlackhawkGT commented 2 months ago

gmod_uncache_test -1 does seem to stop the crashing while gmod_uncache_test 1 does not but it also stops crashing when using gmod_mcore_test 0? None branch does not crash for me after trying for 8 hours straight even with gmod_mcore_test 1 or 2 (though I don't even remember if it does anything on the none branch) while the x86-64 branch does.

I have been trying to figure things out for more than a few days and crashes are seemingly caused by any of the player models we have in the workshop item (player models downloaded from fastdl did not trigger the crash, since not using custom player models from the workshop item stopped crashing altogether). Using default models don't cause a crash either.

A map called mg_neox_multigames_pbeta2 has also started to crash me while loading in when it hasn't before. It seems creating a lot of materials using CreateMaterial increases the chance of crashing even faster with gmod_uncache_test on 2 and 1 when using workshop items (giving me a different kind of crash dump related to materialsystem.dll). I'm not sure if they are fully related but it's worth noting that using gmod_uncache_test -1 stopped that crashing too. - see edit. I can't seem to recreate this in Sandbox but I can in the Minigames gamemode I have at 94.23.144.37:27015 and this only happens when I load in a player model using Player:SetModel(mdlpath) on GM:PlayerSpawn(). Crashing chance decreased when I disabled all CreateMaterial's but it still happened. I can't recreate this on the other maps either.

Anyway, I was able to reproduce some kind of crash with gmod_uncache_test 2 or 1 (I don't know if you can reproduce this easily without the gamemode but I'll give the steps anyway for now) with this using mg_neox_multigames_pbeta2:

resource.AddWorkshop("3054128816") // Server Content: Player Models

Somewhere in cl_init.lua or anywhere to instantly load it on the client:

local function TestCreateMaterial()
    local vmt = {
        ["$basealphaenvmapmask"] = 1,
        ["$basemapalphaphongmask"] = 1,
        ["$basetexture"] = "",
        ["$bumpmap"] = "",
        ["$color2"] = "[1.3 1.3 1.3]",
        ["$envmap"] = "env_cubemap",
        ["$envmapfresnel"] = 0.6,
        ["$envmaptint"] = "[0.01 0.01 0.01]",
        ["$phong"] = 1,
        ["$phongalbedoboost"] = 12,
        ["$phongalbedotint"] = 1,
        ["$phongboost"] = 6,
        ["$phongdisablehalflambert"] = 1,
        ["$phongexponenttexture"] = "",
        ["$phongfresnelranges"] = "[0.6 0.75 1]",
    }

    for i = 0, 1000 do
        print(CreateMaterial("testmaterial_" .. i, "VertexLitGeneric", vmt))
    end
end

TestCreateMaterial()
function GM:PlayerSpawn(ply)
    self:PlayerSetModel(ply)
end

function GM:PlayerSetModel(ply)
    ply:SetModel("models/gfl2/drhunter/groza/groza_r_pm.mdl")
end

Then just use that map (I used a local multiplayer server) and keep using changelevel until it crashes. Depending on gamemode you might have to do team.SetSpawnPoint(teamhere, {"info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_counterterrorist", "info_player_combine"}) as well since it's a CS:S map.

I've included the map and crash dump: mapanddump.zip

EDIT: So it seems that map crash is not related to gmod_uncache_test but it is related to gmod_mcore_test not being 0 so it's probably unrelated to this crash. However I somewhat fixed the map crash issue on my end simply by just doing:

MULTICORECONVAR = GetConVar("gmod_mcore_test")

if MULTICORECONVAR then
    MULTICORECONVAR = MULTICORECONVAR:GetInt()
    RunConsoleCommand("gmod_mcore_test", "0")
end

hook.Add("Think", "SH_GetLocalPlayer", function()
    MySelf = LocalPlayer()

    if MySelf && MySelf:IsValid() then
        timer.Simple(0.5, function()
            if MULTICORECONVAR then
                RunConsoleCommand("gmod_mcore_test", tostring(MULTICORECONVAR))
            end
        end)
        hook.Remove("Think", "SH_GetLocalPlayer")
    end
end)

It might be stupid to do that but hey it works for now.

legionzs commented 2 months ago

For the custom player models, I doubt they are the issue since I checked, if not all, most player models from the content file the OP posted and they had proper bones/animations/materials-setup. (I may have missed something there)