Facepunch / sbox-issues

175 stars 12 forks source link

Large lag spikes seemingly due to GC #5957

Open IMCraytex opened 1 month ago

IMCraytex commented 1 month ago

Describe the bug

The game and editor will randomly spike in frametimes causing a hitch, for afew frames. Seems to happen every 2-8 minutes with varying intensity, In the Editor's Performance profiler it shows the rendering jump up to the triple digits like so image This is what the Profiler looks like in Superluminal when the spikes occur. image

The Superluminal session is too big to share here please contact me If needed.

Afew of my main thoughts of what this could have been was maybe background asset loading/shader compilation and whilst it does happen more when loading in an asset at runtime I don't think they are the same thing.

To Reproduce

  1. Open Either S&Box and play a Random game or The Editor, 2. Playtest or play the game and randomly you will get large hitches in framtimes causing the game to freeze for afew frames

Expected behavior

The gameplay should be as smooth as possible with no hitches. especially on a mainly empty game

Media/Files

No response

Additional context

OS : Windows 11 Pro 23H2 Processor : AMD Ryzen 7 5800x Stock Memory : 32gb DDR4 3600mhz GPU : NVIDIA RTX 2070 Super Drive S&box is installed to : Samsung 990 PRO M.2 2tb

If you have any questions I would be happy to help.

IMCraytex commented 1 month ago

Seemed to narrow it down a little with this being one of my largest spikes yet. image image Seemingly the issue is with garbage collection. Here are the callstacks aswell if they prove useful image

IMCraytex commented 1 month ago

Did some more testing, By changing this line on sbox.runtimeconfig.json "System.GC.Server": true to "System.GC.Server": false It almost eliminated these hitches, They were still there just less frequent and not as intense. But this was at the cost of a much lower performance, This is all I can report from my end. Hope its enough!

IMCraytex commented 1 month ago

Quick update. and bump, But changing System.GC.Server to false seemed to work yesterday but today it stopped working. The spikes occur in every single game. including a blank scene. Hope this gets looked at soon