Skip to content

Constant microstutters in Vulkan after a while of playing the game. (**Not related to dxvk state cache generation**) #2901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alou-S opened this issue Dec 21, 2021 · 194 comments
Labels

Comments

@alou-S
Copy link

alou-S commented Dec 21, 2021

Your system information

OS: Arch Linux x86_64
Kernel: 5.15.8-228-tkg-pds
CPU: Intel i3 540 (4) @ 3.067GHz
GPU: NVIDIA GeForce GT 710
Memory: 4GB

Please describe your issue in as much detail as possible:

The game stutters after a certain amount of time playing it. These stutters are mostly constant when in a match. When in the menu the stutters only happen during input events. (Moving/Clicking Mouse, Pressing button on keyboard).

  • The stutters happen consistently when in a match (with our without input events)
  • Not related to dxvk state cache generation (the thing the other issue is about)

The stutters can be fixed by simply restarting the game.

Video of the Problem : https://cdn.discordapp.com/attachments/828263278542716938/922863969247584276/Menu_Stutter.mp4

Steps for reproducing this issue:

  1. Start CS:GO with -vulkan startup flag
  2. Play Game.
  3. Keep playing game for a while.
  4. Experience constant stuttering.
@kisak-valve
Copy link
Member

Hello @alou-S, this issue is already being tracked at #2891. Closing as a duplicate.

@alou-S
Copy link
Author

alou-S commented Dec 21, 2021

@kisak-valve This is not related to the original issue. Most of the complaints on the original issue are caused by generation of dxvk state cache. Its common behaviour for games using dxvk to stutter while the pipelines are compiled and cached.

This issues is after complete compilation of the state caches. The game doesn't stutter normally until something triggers it and the consistent stutters start.

@kisak-valve
Copy link
Member

I'm not convinced this is a distinctly separate issue from #2891, but I'll give you the benefit of the doubt.

@lionblaze55
Copy link

I have been experiencing this as well. The issue is very different from the initial, random frame drops that occur from the cache generation. After a few minutes on the map these go away from me and the game runs incredibly well. However, after about half an hour in game, the frame rate experiences regular drops, in perfect timing. it feels like 2-3 spikes per second. This can only be fixed by restarting the game, and will be fine for a while longer until the same issue occurs.

@MichaelDeets
Copy link

I've experienced something similar. After around 20-30 minutes of smooth gameplay, it causes my game to lag uncontrollably until a restart. I also experience "normal" stutters that I would assume was caching; though this is different as it is constant and doesn't stop until the game is forcefully closed/restarted.

Don't see any errors in console (starting Steam from terminal), and I tried using RADV_DEBUG hang but I don't see any output.

@ChristophHaag
Copy link

Can confirm with RX 6900XT and mesa git.

After a while (~20 minutes? didn't measure) of playing arms race it becomes basically a slideshow, very suddenly with no apparent cause.

system_info.txt

A few seconds of frame time data after it starts happening: output.txt
csgo_slideshow

Captured by running csgo with VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay VK_LAYER_MESA_OVERLAY_CONFIG=output_file=/tmp/output.txt,control=mesa_overlay,fps_sampling_period=0 %command%

Then after the issue started:

mesa-overlay-control.py start-capture
mesa-overlay-control.py stop-capture

gnuplot: plot '/tmp/output.txt' using 0:4 with lines, 16600 with lines

@RyanBlakeIT
Copy link

Did not realize there was a separate thread for the FPS stuttering. See below for the post I made on #2891 (#2891 (comment))

Installed Arch Linux with KDE Plasma but still having the stuttering issue after a while of gameplay.

At first it was stuttering while it cached the shaders, but after that finished, it became very smooth until after a couple rounds of DM when it dropped down to 60fps and was very choppy.

Got this error in console:

image

Resource materials/panorama/images/icons/equipment/world.svg failed to load. 0: Reinitialized 4 predictable entities

Manually typed the above because copy and paste isn't working for some reason. Screenshot from clipboard.

System Info: https://gist.github.com/RyanBlakeIT/818fc7a5c23e0b3e32d9067dc10a0155

@RyanBlakeIT
Copy link

@kisak-valve Anything else you or your team needs to triage this issue? I'm on vacation this week so I have some time to assist in the diagnosis of this issue.

@kisak-valve
Copy link
Member

Hello @RyanBlakeIT, friendly note that I'm a moderator for Valve's issue trackers on Github, and not a Valve developer myself. We'd need to hear from a CS:GO dev if they want specific information to help them look into this issue further.

@RyanBlakeIT
Copy link

RyanBlakeIT commented Dec 29, 2021

@kisak-valve Okay, I thought maybe you were also an interface to the development team (as a 'go-between'). My apologies if I wrongly ass-u-me-d. :-(

@CommanderAlchemy
Copy link

CommanderAlchemy commented Jan 6, 2022

Same issue, works perfectly fine some rounds and then the stutters just comes in like a face slap.

With net_graph 3 I see frame variance of 20+ ms.
Tried to limit fps using fps_max 0 => 244 the same variance will occur no matter what.

Before the issue kicks in I have stable FPS without any issues.
Noticed that as soon as I bring up the developer console "fixes" the stutter somewhat. (variance drops to 0.5 ms)

6900xt
AMD 5900x
Steamsysteminfo

@kisak-valve
Copy link
Member

Vulkan fps boost gone after a while

Issue transferred from #2910.
@x0r13 posted on 2021-12-30T23:49:03:

Your system information

https://gist.github.com/x0r13/29f662b707727215480c0f483b46b0c4

After trying out the new -vulkan I got a very noticeable fps boost from around 100fps to ~170fps. I played a few matches, and everything was fine (after the stutter from shader creation is gone). Yesterday, the fps boost was gone, and it was back as vulkan wasn't used. I was back at ~100fps, but vulkan was shown in windowed mode, so I guess it was in fact used (also, shaders were being created).

I completely removed steam and all games, reinstalled steam and csgo and tried again. FPS were good again, so I was happy. Today, the same as yesterday happened. FPS are back at 100fps. I deleted the shader cache, and they were re-created, but FPS are still bad.

Any idea what the problem is? Also, is there at least a way to somehow reset steam/csgo without uninstalling everything?


@x0r13 commented on 2021-12-31T02:10:30:

Little update, since this is really weird. I was playing a match (with my low 100fps) when suddenly everything started lagging like crazy. FPS shown where around 100-120 but it felt like 5fps. So I ALT + F4 out of the game and reconnected, and I'm back at 200fps+ ? I tried everything before, but nothing worked.

But that weird lagging happened in two other games as well, out of nowhere it's a slideshow and I have to completely close the game and reconnect.

EDIT: Another thing I noticed: When that lagging happens during a game, and I press ESC to bring up the menu, the fps are instantly back to normal, butter-smooth. As soon as I return to the game, it's lagging again.


@ilievi187 commented on 2022-01-03T20:43:00:

maybe someone from your team or oponents using other kind of software :)


@x0r13 commented on 2022-01-04T23:07:54:

Why would anything another player might have on his client side affect mine? To me it looks like the FPS cannot be correctly synced anymore


@CommanderAlchemy commented on 2022-01-06T13:39:48:

@x0r13 Could this issue be related? #2901
Does it stutter for you or is it smooth just fps gone?

Feels like this is the same issue


@x0r13 commented on 2022-01-06T22:28:09:

@CommanderAlchemy No, I haven't experienced stutter in the main menu (but I have limited fps in menu to 60 anyway). My problem is simply that my fps are instead of ~170 all of a sudden 90-110. I can't find a cause for this. Restarting my PC or re-installing steam does not help. Also deleting the shader cache does not help.

Yesterday, the fps were good again (I do not know why) and I was able to play 5 matches without any problems. Today it's back to low fps again.

The other problem I mentioned was extreme lagging/stuttering during a game, which was only in gameplay, and went away when bringing up the menu via ESC key. As soon as I returned to the game it stuttered again. This was reproducible every time I brought up menu and exited it. I had to restart the game to get rid of it. This issue happened four times so far. It appears all of a sudden during game, but I have no way to reproduce it. Yesterday it did not happen.


@lionblaze55 commented on 2022-01-10T20:32:53:

@kisak-valve apologies for the ping (I am sure you are busy) but when you have the chance I think we can close this as a duplicate of #2901. Word for word same issue it seems. @x0r13 if you can close the issue yourself and/or re-post on the aforementioned ticket, that would be great!

@alou-S
Copy link
Author

alou-S commented Jan 18, 2022

Okay so after the recent update I have watched a live match for like 40 minutes. The micro stutter behavior didn't seem to start in said 40 minutes.
I will play the game for a hour or two when I get some free time to do so and make sure that the problem is gone.

I would like others to confirm if the problem is gone from their end. @lionblaze55 @ChristophHaag @MichaelDeets @RyanBlakeIT

@MichaelDeets
Copy link

MichaelDeets commented Jan 18, 2022

Okay so after the recent update I have watched a live match for like 40 minutes. The micro stutter behavior didn't seem to start in said 40 minutes. I will play the game for a hour or two when I get some free time to do so and make sure that the problem is gone.

I would like others to confirm if the problem is gone from their end. @lionblaze55 @ChristophHaag @MichaelDeets @RyanBlakeIT

I will play a few games today and see. It would usually lag out 1 or 2 times per full 30 round game, so I will try playing a couple matches without restarting.

EDIT: as @ChristophHaag said, it still happens.

@ChristophHaag
Copy link

Still happening

@ghost
Copy link

ghost commented Jan 19, 2022

I have been experiencing this as well. The issue is very different from the initial, random frame drops that occur from the cache generation. After a few minutes on the map these go away from me and the game runs incredibly well. However, after about half an hour in game, the frame rate experiences regular drops, in perfect timing. it feels like 2-3 spikes per second. This can only be fixed by restarting the game, and will be fine for a while longer until the same issue occurs.

So my problems of freezes from 10-20 seconds are "cache generation" on Vulkan? Will it ever be fixed? How to speedup cache generation then?

@romanstingler
Copy link

romanstingler commented Jan 21, 2022

There is also a beta NVIDIA driver available with hundreds of vulkan fixes.
https://www.nvidia.com/download/driverResults.aspx/184911/en-us

and please
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1
just put this in your /etc/environment and reboot.

You can also try
__GL_THREADED_OPTIMIZATIONS=0

@MichaelDeets
Copy link

MichaelDeets commented Jan 22, 2022

There is also a beta NVIDIA driver available with hundreds of vulkan fixes. https://www.nvidia.com/download/driverResults.aspx/184911/en-us

and please __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 just put this in your /etc/environment and reboot.

You can also try __GL_THREADED_OPTIMIZATIONS=0

For CS:GO specific environment variables, I'd recommend adding them to csgo.sh

No need to restart between changes with this method. The environment variables will be applied to CS:GO only. There are a couple environment variables there by default anyway.

It's unlikely to be fixed in driver updates. I'm not even using nVidia and I still get the issue.

@CommanderAlchemy
Copy link

CommanderAlchemy commented Jan 24, 2022

Replying to #2901 (comment) #2901 (comment)

You can set them as launch options too in steam for this game.
Also i cannot see why __GL would affect Vulkan ?

And same for me I'm running AMD w/ radv

@MichaelDeets
Copy link

MichaelDeets commented Jan 24, 2022

Replying to #2901 (comment)

Yeah, nvidia-only OpenGL environment variables wont do anything for Vulkan.

I quite like using csgo.sh if I need to add more than a couple environment variables, as changing the launch options in Steam isn't the easiest. You can also add launch options inside of csgo.sh (which I do instead of using Steam's properties menu) like this:

https://i.imgur.com/PnWKvcu.png

Also, while this is useless for me, the options will persist between accounts when using csgo.sh. When I do change accounts, I often forget to set launch options.

Replying to #2901 (comment)

https://download.nvidia.com/XFree86/Linux-x86_64/410.66/README/openglenvvariables.html

As shown in the link, these are for OpenGL (hence the '__GL' prefix).

@alou-S
Copy link
Author

alou-S commented Jan 26, 2022

Okay so good news is that I don't face the microstutters after a while anymore.
Bad news is that the game crashes every 30 to 40 minutes now.

So basically the microstutters are replaced with crashes.

@CommanderAlchemy
Copy link

Okay so good news is that I don't face the microstutters after a while anymore. Bad news is that the game crashes every 30 to 40 minutes now.

So basically the microstutters are replaced with crashes.

Maybe not the same thing but at least now you get a trace on the crash, do create a new issue for it.

@ChristophHaag
Copy link

No crash here, but the issue is still happening on 2/1/2022

@soerengrunewald
Copy link

soerengrunewald commented Feb 6, 2022

Your system information
OS: Fedora 35
Kernel: 5.16.5-200.fc35.x86_64
Mesa: 21.3.5-1.fc35
CPU: Ryzen 5600X
GPU: Vega 56
Memory: 32GB

Steps for reproducing this issue:
I did some experiments to find some systematics. Using the following command-line and the using the symlink to libtcmalloc_minimal.so.0 workaround:
DXVK_HUD=frametimes,fps MESA_GLSL_CACHE_DISABLE=1 MESA_DISK_CACHE_SINGLE_FILE=1 %command% -novid -nojoy -nohltv +fps_max 144 -tickrate 128 -vulkan

  1. It tried X11 vs Wayland session, no difference there.
  2. I timed how long it took, till the stuttering starts, the answer is ~26m30s, reproduced 3 times
  • Started the game
  • Started a "Training with Bots" session at Office with Expert Bots
  • Start the timer when loadings starts ~2-3rounds
  1. Than a bit of recoil training. And the result is roughly the same ~25m45s.

Can anyone reproduce this?

@MichaelDeets
Copy link

Replying to #2901 (comment)

If you want to change DXVK cache variables you should use DXVK_STATE_CACHE and DXVK_STATE_CACHE_PATH (the MESA_ variables you used wont change anything for DXVK).

I remember trying to reproduce the issue on my community server (hosted on a separate computer) and found some strange results. Once, I left my computer AFK for 6+ hours overnight and found no issues. Usually when playing on the server (2-4 total players), it would occur at least once during the game (each game would probably take about 25 minutes, which corresponds with what you experienced).

I'm going to do some actual testing (timing start of the game, when the uncontrollable lag occurs, what I was doing, etc.).

@BatStak
Copy link

BatStak commented Jan 17, 2023

@niereklamuj Thanks for the info. Good advice to use cpupower-gui.

My PC is only for gaming and has no battery so I think I will keep the global governor strategy because I always play when I use this PC. But you are right for most users. And it's probably slightly better for energy consumption. It seems that performance strategy does lower the CPU frequency when not used but go instantly maximum speed if applications require some CPU power.

@GreatBigWhiteWorld
Copy link

ENABLE steam overlay instead of disable it to fix the 30 mins stutter fps drops when using '-vulkan'.

However this simple solution has been drown by spam messages from one person.

@MichaelDeets
Copy link

Replying to #2901 (comment)

No, these OpenGL environment variables did not fix the DXVK stutter issue... the only thing that "fixes" the issue is the LD_PRELOAD="" environment variable, nothing else is relevant.

Replying to #2901 (comment)

The CPU governor has nothing to do with this issue.

@BatStak
Copy link

BatStak commented Jan 31, 2023

@MichaelDeets

Governer CPU is the main thing that has fixed the stuttering for me. After a while playing, it was the reason (probably higher temperature).

__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 is a known issue with nvidia which is a valid fix for vulkan on opengl to avoid having max size for shader cache for all games. This is a global thing that provoke stuttering from the start, not specifically "after a while".

The other things are irrelevant in my case and LD_PRELOAD was already empty on my side.

@henrym11106
Copy link

@batmen

Governer CPU is the main thing that has fixed the stuttering for me. After a while playing, it was the reason (probably higher temperature).

The other things are irrelevant in my case and LD_PRELOAD was already empty on my side.

That seems like a different issue than the one being tracked here. in my case I was always using the "performance" CPU governor and also keeping GPU clocks high. my CPU and GPU run at 45-55c so power and temperature throttling were never a problem.

this issue does not appear to relate to system performance at all; it's basically the game consistently freezing many times per second after being open for about 30 minutes or more, whether or not the game is actually doing anything in that time, and it only stops stuttering after quitting and relaunching CSGO, upon which it's immediately fine for another 30 minutes or so.

the only fixes so far: leave the Steam overlay enabled or use LD_PRELOAD="" if you want it disabled.
as long as I use either option I have no problems.

@MichaelDeets
Copy link

MichaelDeets commented Feb 1, 2023

Replying to #2901 (comment)

The CPU governor has nothing to do with this issue. Absolutely nothing. Perhaps you have better performance using a different governor setting, but that is still irrelevant to this specific stutter issue.

The other things are irrelevant in my case and LD_PRELOAD was already empty on my side.

LD_PRELOAD is set by the csgo.sh executable, the global value of this environment variable (what the system uses outside the game) is not relevant, as it would be changed specifically for the game process. Forcing the LD_PRELOAD value to nothing, specifically for CS, is the only fix, everything else is not relevant.

@BatStak
Copy link

BatStak commented Feb 1, 2023

I'm tired of explaining shit. If I can help someone somewhere with this issue and with LD_PRELOAD not fixing anything. Good enough.

@MichaelDeets
Copy link

I'm tired of explaining shit. If I can help someone somewhere with this issue and with LD_PRELOAD not fixing anything. Good enough.

Absolutely none of the "help" you've provided is relevant. The only, and I repeat, ONLY fix is making sure csgo uses LD_PRELOAD="". The global value of LD_PRELOAD is unrelated, as it would be specifically set by csgo.sh (perhaps try opening csgo.sh and look for yourself).

Nothing else will help fix this issue, aside from LD_PRELOAD="" for specifically csgo (I'm NOT talking about the globally set value of LD_PRELOAD). Everything you've mentioned has already been talked about and deemed irrelevant, yet we are still talking about CPU governors and OpenGL environment variables...

@BatStak
Copy link

BatStak commented Feb 1, 2023

@MichaelDeets I know the issue I got.

I keep trying things for a week and the ONLY things that have fixed the stutter are the shader cache and the CPU governer. Period.

@lionblaze55
Copy link

@batmen as already mentioned by others, your issue is clearly different from the one being tracked on this thread. While you may feel you are helping, you are actually hurting by adding noise to the conversation and confusing the situation for users as well as people trying to solve the problem. Glad you fixed your issue, but please discuss it elsewhere. Thank you!

@GreatBigWhiteWorld
Copy link

GreatBigWhiteWorld commented Feb 2, 2023

Replying to #2901 (comment)

Can you try enabling steam overlay for csgo without using LD_PRELOAD="" (with -vulkan in launch option of course)?
LD_PRELOAD="" worked for the native steam but not the flatpak version steam on the same machine. I found out that I could just enabling steam overlay for csgo (counter intuitive I know) and the 30 mins stutter time bomb was gone forever.

@lionblaze55
Copy link

Enabling steam overlay fixed the issue for flatpak for me too. Been months since experiencing any issue on flatpak csgo simply because of that :)

@henrym11106
Copy link

So weird that disabling overlay can even cause this. glad I caught that and reported my findings errr I mean polluted this issue with that information lol

@ziprasidone146939277
Copy link

Hello.

Still testing but for now I can confirm that enabling "Steam Overlay" (in my case was globally disabled) and only with -vulkan launch option in CS:GO fixes the issue at the moment.

On the other hand, and reading the comments over the issue, I tested the LD_PRELOAD="" launch option in Doom Eternal. In Doom the issue is that launching the game from Steam it start at 15 FPS while launching from CLI (steam steam://rungameid/782330) works well for hours at +100 FPS. I mentioned DOOM because this thread and its comments, helped to me to fix the two problems. For now.

I will update as I play more time CS:GO, and see if the Steam Overlay was really the culprit of this: After 20 mins. of game FPS drops to unplayable value.

Before I found this thread, I tried almost everything related to Drivers, X11, Wayland, NVIDIA Drivers, S.O. and so on. So I guess, in my case, that both are a Steam specific problems on Linux.

Regards

@tklieber
Copy link

tklieber commented Jun 15, 2023

Hi, I got the same problem from tree or for weeks now. I've tried all possible manipulations but it is the same. The game becomes slow after 5 to 10 minutes of game and a input lag appears.
The LD_PRELOAD="" changed nothing for me.

I'm on Fedora 38 with Wayland. I was on KUbuntu and is was the same.
My CSGO lauch options are : LD_PRELOAD="" %command% -novid +fps_max 0 -nojoy -vulkan

Best regards.

@feer9
Copy link

feer9 commented Aug 12, 2023

I can confirm the LD_PRELOAD="" env solved this issue for me, also running on arch linux.

It's unbelievable this issue has been around for almost two years and there's no official solution whatsoever.

@rodrigo-ceccato
Copy link

Using vulkan, on Arch Linux 6.7.6-arch1-2, i9-13900HX, RTX 4090 laptop (550.54.14), HUGE improvement if I use in launch options -threads 8

@stashymane
Copy link

stashymane commented Jan 8, 2025

Same issue, game just keeps stuttering more over time, becoming unplayable after 10-20min. LD_PRELOAD="" and other fixes listed here did not change anything for me. What did, however, was lowering VRAM usage by lowering texture quality. For me, the stutters start almost always when the VRAM is maxed out. This same graphics card had no issues running the game on Windows at 150-250fps on most maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests