steam-for-linux icon indicating copy to clipboard operation
steam-for-linux copied to clipboard

lag spikes after 25-40 minutes of playing on linux

Open darix opened this issue 1 year ago • 213 comments

A lot of details are already collected in:

https://github.com/doitsujin/dxvk/issues/4436

it could be related for a LD_PRELOAD added for the "record your game" feature?

the workaround while we wait for the fix

please see this comment for all the details https://github.com/doitsujin/dxvk/issues/4436#issuecomment-2466646597

darix avatar Nov 11 '24 01:11 darix

Can confirm the findings of that thread on KDE Tumbleweed Wayland.

It started happening around the time "record your game" rolled out for me.

TerohsLab avatar Nov 11 '24 02:11 TerohsLab

Valve should fix all the preload errors that spam the console when using it and playing games

LethalManBoob avatar Nov 11 '24 02:11 LethalManBoob

Pulling this from a reddit topic I saw where the user also had the issue, may be relevant:

"When I run 'top' in the terminal I see the game running 'engMain', when I have it focused, the %CPU will show somewhere between 300 - 400 when not moving my mouse - the game runs fine. When I touch my mouse the %CPU value plummets to about half of whatever was initially shown and the game stutters. This does not happen when the game is initially started"

HeinsKetchup avatar Nov 11 '24 03:11 HeinsKetchup

I'm the one who started this recently in the other repo issues and I can confirm that it is still happening. You can get rid of this by using LD_PRELOAD="", but you can still use LD_PRELOAD to preload your own libraries.

Can confirm the findings of that thread on KDE Tumbleweed Wayland.

It started happening around the time "record your game" rolled out for me.

Exactly.

SheMelody avatar Nov 11 '24 10:11 SheMelody

Also happens to me on gnome 47, Wayland, fedora 41, Nvidia 560 and 565, started happening when the game recording update came out. Additionally I'm not sure if it's part of the same problem but with the overlay enabled doing nothing (no game recording enabled, no windows, no chat, nothing) the overlay vram usage balloons to almost 2gb reported by nvidia-smi.

pkly avatar Nov 11 '24 10:11 pkly

@kisak-valve I just want to add that this also happens when the overlay is turned off through the Steam UI.

(with also both game recording and steam input disabled as well, from the UI of course)

https://github.com/doitsujin/dxvk/issues/4436#issuecomment-2466438353

SheMelody avatar Nov 11 '24 10:11 SheMelody

Having the same problem, started after the Steam Game Recording update as well, enabling the overlay fixed the problem.

rfberaldo avatar Nov 11 '24 14:11 rfberaldo

I've had this issue for years https://github.com/ValveSoftware/csgo-osx-linux/issues/2901 but I only play 1-2 games, so after CS:GO moved to CS2, the issue went away.

But for years, CS:GO using DXVK native required LD_PRELOAD=""

MichaelDeets avatar Nov 11 '24 15:11 MichaelDeets

gameoverlayrenderer.so most likely culprit

d3nd3 avatar Nov 11 '24 17:11 d3nd3

gameoverlayrenderer.so most likely culprit

It definitely is.

SheMelody avatar Nov 11 '24 17:11 SheMelody

But many of us have the steam overlay and recording feature turned off in the options. So why would it even load that?

TerohsLab avatar Nov 11 '24 17:11 TerohsLab

But many of us have the steam overlay and recording feature turned off in the options. So why would it even load that?

That's probably part of the bug. /environ shows that the library still loads even though those things are turned off. Hence why LD_PRELOAD="" fixes the issue (prevents said library from loading).

SheMelody avatar Nov 11 '24 17:11 SheMelody

While it does seem like people have helped corner the source of the issue, I figured a little more information couldn't hurt.

Note that using LD_PRELOAD as SheMelody suggests appears to have fixed my issues, will need to test further to confirm but initial tests has been very promising. A huge thank you to them as when I look further at this issue it's clear they put in a lot of legwork on trying to help pinpoint this issue.


After the steam update about a week ago, the one that apparently added in additional recording features as well as updated to runtime environments scout, soldier and sniper, both of my linux systems would have issues playing games through proton. I'd notice the odd tiny bit of jitter while playing, but after 20-50 minutes (depending on game and game settings) I'd start getting horrible framerate drops whenever I...

  • moved the mouse
  • gave input on the keyboard

The stuttering would last for about a second after the input stopped, and if the input was just a single key press that was held for a few seconds it would stop. As I had a controller connected I switched to that and the game I was playing (subnautica) ran perfectly smooth, went back to mouse and keyboard? Stuttering. This stuttering also appeared to be framerate only, as on the main menu of one of the games (Again, Subnautica) the mouse cursor would move smoothly, but the background animations would stutter like mad while I was moving the cursor once I had hit this 'time to stutter' threshold.

So whatever issue is involved with this overlay issue is also tied with mouse and keyboard input. At least on my end after some testing. What I did not do is continue using the controller for another 50 minutes or so to see if there's some sort of 'input buffer' that fills up with a specific kind of input that would cause the controller input to start lagging.

This was also exclusive to steam, as I have games that run natively on linux or I use regular WINE for that do not suffer this stuttering issue.

I'll also give additional system information on both of my systems below, the only thing that unifies the two systems is that they are linux, are AMD CPU and graphics and the three games I tested had some sort of internet traffic, though both machines run on completely different internet connections (wired/wi-fi) and ISP's.

Desktop (Tested with Subnautica with Archipelago multi-world randomizer):

  • Custom build
  • Arch Linux : KDE Plasma 6.2.3 , Wayland
  • CPU: AMD Ryzen 9 7900X 12-Core
  • Graphics: AMD Radeon RX 7900 XT

Laptop (Tested with Helldivers 2 and Mechwarrior Online):

  • Framework 16 Laptop
  • Linux Mint 22 Cinnamon (Cinnamon 6.2.9) , x11
  • CPU: AMD Ryzen 9 7940HS
  • GPU: AMD Radeon RX 7700S

Steam overlay has been entirely disabled through the Steam UI on both PC's as well.

Tridale avatar Nov 13 '24 12:11 Tridale

Yes, LD_PRELOAD="" fixes it for me as well, but do I need to put it in the launch options for every game or can I set it globally?

netborg-afps avatar Nov 13 '24 13:11 netborg-afps

Yes, LD_PRELOAD="" fixes it for me as well, but do I need to put it in the launch options for every game or can I set it globally?

Do not set it globally, no.

SheMelody avatar Nov 14 '24 12:11 SheMelody

I've been having the same symptoms using conty_lite.sh w/ Slackware current from the 8th Nov or so: Subnautica becomes unplayable slideshow after 1/2 hour to an hour (playing with kb/mouse).

After the LD_PRELOAD workaround this seems to have gone away. Thanks for that!

I still see "ERROR: ld.so: object '/home/pete/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored." with the workaround in place and overlay disabled for the game and then disabled globally.

Wonder if it's some byproduct of setenv changes ?

ndrspcfd avatar Nov 15 '24 11:11 ndrspcfd

Disabling steam game recording on a per-game basis through its settings UI seems to solve this issue for me without losing other things. (Game tested: Warframe)

atimeofday avatar Nov 15 '24 14:11 atimeofday

If you're using gamemode you can just use this hack to temporarily hide gameoverlayrenderer.so from the game without messing with other libs:

~/.config/gamemode.ini

[custom]
start=mv ~/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so ~/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so.bak; mv ~/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so ~/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so.bak
end=mv ~/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so.bak ~/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so; mv ~/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so.bak ~/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so

UPD. No, it isn't the best approach because gamemode doesn't wait for script to exit so it's possible it'll launch the game before the lib is hidden.

phpony avatar Nov 16 '24 11:11 phpony

Had similar issue with The Witcher 3. After 30-50 min of smooth playing, the game stutters significantly with constant FPS drops. Launching the game with LD_PRELOAD="" seems to have fixed the issue.

ShikharArvind avatar Nov 17 '24 19:11 ShikharArvind

TBH: if all you want to add to the bug is "oh yeah i had that issue too and the solution helped me" please just click the thumbsup in the initial post in this thread. those comments do not add any more useful information to the issue.

Thank you in advance.

darix avatar Nov 17 '24 19:11 darix

I want to add that doing LD_PRELOAD="" breaks the steam ingame overlay (obviously) but also doesn't completely solve the issue. Anytime steam pushes a notification, such as a friend going online, the system hangs will still happen. As well as having the full steam interface as the primary application will cause major slowdowns with a game running. Minimizing the steam window (or having it in the background) is fine.

MissPotato avatar Nov 19 '24 19:11 MissPotato

I got this problem on Fedora KDE (Wayland NVIDIA). I notice that in the console when the stuttering happens, I get this message: [InputSystem] Processing SDL events took 50.1ms, spammed in the console.

Edit: This was for Counter Strike 2. Forgot to mention the game.

ztancrell avatar Nov 25 '24 23:11 ztancrell

We can probably try to add VK_LAYER_VALVE_steam_overlay_64 (or the 32-bit version depending on the game) to the VK_LOADER_LAYERS_ENABLE variable.

LD_PRELOAD="" VK_LOADER_LAYERS_ENABLE=VK_LAYER_VALVE_steam_overlay_64 %COMMAND%

Haven't tried this, but it would be interesting if this doesn't cause the issue. Note: untested, and will only work with Vulkan / DXVK / VKD3D, and not with OpenGL / WineD3D.

SheMelody avatar Nov 26 '24 06:11 SheMelody

I just want to add in, when I was having the cursor lag after 40 mins in game couple weeks ago it was present in both Steam and Lutris. So may want to test your current version of proton inside Lutris and see if it happens as well to narrow down the issue.

OneWiseKnight avatar Nov 26 '24 13:11 OneWiseKnight

I had a similar issue with Dead by daylight where it starts lagging around after 30-40 minutes after I start playing. Adding LD_PRELOAD="" didn't do anything for me. However, I noticed that when I enabled the steam overlay(with steam recording still disabled) the lag no longer happened.

remybin avatar Nov 30 '24 07:11 remybin

Did you add LD_PRELOAD="" or LD_PRELOAD="" %COMMAND%? You may need the %COMMAND% part for it to actually work.

viocar avatar Dec 03 '24 21:12 viocar

Interestingly enough when I add LD_PRELOAD="" %COMMAND% Dead by Daylight will crash for me. I'm fine with just having the overlay enabled.

After looking at some older issues mentioned here (#2901) seems like this is an old issue and apparently the only known fixes are enabling overlay or adding the LD_PRELOAD flag.

Hopefully nobody with this issue needs to have the overlay disabled along with having the LD_PRELOAD flag solution not work for them...

remybin avatar Dec 04 '24 03:12 remybin

Happens in unity games as well, by the way. Slipways and Against the Storm are both affected.

Interesting thing: During the lagspike frames, the game will not pick up any mouse or keyboard input; meaning, if you use short taps or clicks they can get lost. That makes trying to play anything reasonably quickly a big problem.

AphidGit avatar Dec 07 '24 17:12 AphidGit

For me it seems to only lag with input (after ~30mins), so FPS is fine until I press/hold a key or move my mouse.

tylerebowers avatar Dec 07 '24 20:12 tylerebowers

So far, this happened for me with every game with the exception of Slay the Spire, which is an OpenGL game. Happens as well with Path of Exile 2 on its Vulkan renderer.

netborg-afps avatar Dec 10 '24 07:12 netborg-afps