Facepunch / garrysmod-issues

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

Non-Existant Materials On Client Cause Lag/Freezing #511

Closed shadowscion closed 4 years ago

shadowscion commented 11 years ago

If someone spawns a prop (via a duplicator or something), and that prop has a material that the client doesn't have, the client will freeze, sometimes up to a minute, depending on how many props were spawned with the material.

Its very common for this to happen if you don't own some source games, or don't have them installed/mounted.

I thought I read that this was fixed, but I guess not.

Python1320 commented 10 years ago

Still not fixed, it's being either exploited or is very common. This causes massive freezes on multiplayer.

Clarification: with 30 invalid-material props the lag is miniscule. Increase that to 50 and the lag is massive.

Mista-Tea commented 7 years ago

Can anything be done about this issue, now that it's been around for 3-4 years? This has become an absolute game-killer on Sandbox.

E.g., upon a client entering a visleaf with multi-hundred prop contraptions that has missing materials (to the client), the client will lag out and keeping moving forward until they noclip out of the world or leave the visleaf, making it almost unbearable to play.

thegrb93 commented 7 years ago

Yeah it sucks. I've had to mod everything that uses custom materials to abide by the server's material list.

thegrb93 commented 7 years ago

30 second lagspikes on some servers. It hurts. Seems to happen when moving between PVSs or outside the map.

shadowscion commented 7 years ago

@thegrb93

I can't believe this hasn't even been acknowledged in the 4 years since I opened it

eventually I got fed up and made a .bat file to create a .vmt for every material from games I don't have, haven't had any issues since

Mista-Tea commented 6 years ago

I had someone on my server grab a TF2 material and apply it to a PHX prop. I've stacked the plate several times to make the effect more noticeable. Essentially, the prop will look completely normal as if no material has been applied to it. However, trying to load the dupe(s) or walking into the dupe's visleaf should lag you out for a good while.

As noted in the FP Next Update thread, you may want to try this on a dedicated server that has all of the source games mounted.

I'm attaching both an AdvDupe2 dupe and a regular Duplicator dupe. Both should have the same effect of lagging you out, assuming you don't have TF2 mounted.

AdvDupe2 MissingMaterialsTest.txt

Duplicator You'll need to change the extension of the 2fcb0fbde52c6d3652ad904df4a6fb0f.txt file to .dupe

2fcb0fbde52c6d3652ad904df4a6fb0f.txt 2fcb0fbde52c6d3652ad904df4a6fb0f

I have all of these mounted on the server, and none of them mounted on my client.

"gamedepotsystem"
{
    "hl2"       "1"
    "episodic"  "1"
    "ep2"       "1"
    "lostcoast" "1"
    "csgo"      "1"
    "cstrike"   "1"
    "l4d"       "1"
    "l4d2"      "1"
    "portal"    "1"
    "portal2"   "1"
    "tf"        "1"
    "dod"       "1"
}
ghost commented 6 years ago

fs_tellmeyoursecrets 1

Why does the game have to search every possible directory, and for each of those plates?

Mista-Tea commented 4 years ago

This is still a terrible issue, so here are some more details to replicate it. I can demonstrate it live if necessary (I have a server setup for it). I just want this addressed because it makes gamemodes like sandbox nearly unplayable if you are simply missing a single material that might be applied on entities on the server.

The amount of lag (read: amount of time client is hanging) experienced seems directly related to the number of paths mounted on the filesystem, as evidenced by fs_tellmeyoursecrets 1 shown above.

Setup:

Steps:

  1. Join the server on gm_flatgrass
  2. Go to the hidden area underneath spawn
  3. Spawn any default prop you have (e.g. models/hunter/blocks/cube025x025x025.mdl)
  4. Run material_override sprops/textures/sprops_metal2 (a material included in SProps that the server will have but you will not)
  5. Use the material tool to apply the material on the prop
  6. Duplicate the prop and spawn it dozens of time (do not skimp on this, it will vary so literally spam it if you have to)
  7. Try noclipping in and out of the hidden area multiple times

Demo Video

https://i.gyazo.com/3dab82ca155330f7336e98b58ca027db.mp4

In the video above, you can see my client lag out as I noclip through the hidden area. This is with only source games mounted and not a single legacy or workshop addon. The issue increases with every addon you mount on the client as the number of search paths grows.

With literally only a SINGLE prop spawned out, this is how many paths it searches when re-entering the PVS.

Duplicate the prop multiple times and you start to get maybe why this lags so much.

(No longer needed, here, but it was searching 84 paths for the material on a single prop)
willox commented 4 years ago

Note: It won't increase in the same way with GMA addons. They don't have this sort of access pattern.

robotboy655 commented 4 years ago

Ok, the gm_flatgrass example was easy to reproduce, thanks.

This should be fixed on Dev. Unfortunately the fix has a side effect - if the material(s) become valid and existing after they are applied to a prop, they will still not load, even if you reapply the material.

Previously it would load the material when you re enter the PVS or reapply the texture. Now calling mat_reloadmaterial on the material will make the above tricks work. (mat_reloadmaterial will clear all missing materials)

I feel like this is a decent trade off - at least it doesn't lag insanely anymore and you should have all the materials ready when joining a server anyway.

thegrb93 commented 4 years ago

Fuck yea. This was the worst bug

Mista-Tea commented 4 years ago

This seems to work as intended. Thank you so much for addressing this -- it's practically a game-changer for sandbox and related gamemodes for clients that are missing optional content.

shadowscion commented 4 years ago

Thank you

shadowscion commented 4 years ago

Is this fixed on the x84-64 branch? Still having the issue.

robotboy655 commented 4 years ago

You are not having this issue, or your client is out of date, such as running Chromium branch.

shadowscion commented 4 years ago

I am and I can reproduce it using the flatgrass example above. I've factory reset and I have also opted out of all the beta branches, still happens.

EDIT: It happens with specific materials and not others, the only difference I have found so far is the offending materials have capital letters in the filename.

robotboy655 commented 4 years ago

Good catch, should be fixed on Dev and other branches by the end of the week.