ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.2k stars 175 forks source link

Steam Freezing while installing games. #7720

Open Redbatman89 opened 3 years ago

Redbatman89 commented 3 years ago

So I think ever since the update for the February 13th release on Tuesday March 23rd may have screwed up my client a bit. Now when I install a game or update the steam client will freeze for a minute randomly then go back to being functional. The games still work and I can play them. But its getting annoying that this is happening now.

I have tried shutting down and powering up my computer, installing the new Nvidia Drivers. But that didn't work so I'm thinking its a client issue. Is this happening to anyone else? I'm on POP OS 20.04

class101 commented 3 years ago

I note this behavior too on Arch Linux, not sure if it is hardware related or Steam client side issue, it started recently but before February probably because I'm using Steam client beta

What I note is that it seems to happen when Steam uses disk access after downloading. For me the symptoms encountered are even worse because it produces intermittent freezes of some part of the desktop, the mouse continue to work but nothing is clickable for a short period, very weird behavior I never experienced before.

It's as if Steam was asking for a higher priority than the kernel and everything Steam does on disk takes priority over vital system functions, such as displaying desktop etc etc.

OS: Arch Linux x86_64 
Kernel: 5.11.9-zen1-1-zen 
Uptime: 8 hours, 30 mins 
Packages: 1280 (pacman) 
Shell: bash 5.1.4 
Resolution: 1920x1080 
DE: Cinnamon 4.8.6 
WM: Mutter (Muffin) 
WM Theme: Mojave-dark (Mojave-dark) 
Theme: Mojave-dark [GTK2/3] 
Icons: McMojave-circle [GTK2/3] 
Terminal: guake 
CPU: Intel i7-4770K (8) @ 3.900GHz 
GPU: NVIDIA GeForce GTX 980 
GPU: NVIDIA GeForce GTX 980 
Memory: 4143MiB / 15937MiB
Disk: Samsung SSD 850 Pro
kisak-valve commented 3 years ago

Most likely newer symptoms of #4978.

Redbatman89 commented 3 years ago

So I did some testing and at first I thought it was only native Linux games giving me the issue since I had downloaded a Windows game too and see what would happen. At First no freezing for one game, so then I tried another and this however it froze a bit. (I play on proton sometimes) So then next I had downloaded a game I pulled up system monitor and to watch for any high cpu usage. Sure enough there was a spike on one of the cores for 100%, and its an Intel I7 4970K quad core.

Thought this may help. Steam has had other issues like this in the past when a few months ago they had to disable shader cache for Nvidia cards due to the client not liking Nvidia Drivers past 440.100 for awhile.

class101 commented 3 years ago

I took a screenshot this morning of my task manager with a steamwebhelper process automatically set to a CPU nice of -10, higher than everything on the system, the only higher process is pulseaudio defaulting to cpu nice -11.

Not saying this is the root cause, but such bad practice could be one of them

steamwebhelper

Most likely newer symptoms of #4978.

Nothing to do with this 4 year old issue.

Redbatman89 commented 3 years ago

A little acknowledgement would be nice Steam.

gbschenkel commented 3 years ago

Hi, using Slackware here. I am having this problem a long time. Got a 15MB update from Satisfactory and it got me 3 minutes just to install it while freezing/hanging the machine. I was running Steam on Console, and got some throughput:

No cached sticky mapping in ActivateActionSet.Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
ExecuteSteamURL: "steam://open/minigameslist"
saving roaming config store to 'sharedconfig.vdf'
roaming config store 2 saved successfully
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Fossilize INFO: Autogroup scheduling is not enabled on this kernel. Will rely entirely on nice().
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
[0420/030653.529455:INFO:crash_reporting.cc(270)] Crash reporting enabled for process: renderer
ExecuteSteamURL: "steam://open/downloads"
Work thread 'CDepotReconstruct - Decrypt Thr' is marked exited, but we could not immediately join prior to deleting -- proceeding without join
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Fossilize INFO: Autogroup scheduling is not enabled on this kernel. Will rely entirely on nice().
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
ExecuteSteamURL: "steam://open/minigameslist"
saving roaming config store to 'sharedconfig.vdf'
roaming config store 2 saved successfully
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
Installing breakpad exception handler for appid(steam)/version(1618256785)
ExecuteSteamURL: "steam://open/largegameslist"
ExecuteSteamURL: "steam://open/downloads"
Installing breakpad exception handler for appid(steam)/version(1618256785)
ExecuteSteamURL: "steam://open/minigameslist"
saving roaming config store to 'sharedconfig.vdf'
roaming config store 2 saved successfully
[2021-04-20 03:16:51] uninstalled manifest found in /home/schenkel/.local/share/Steam/package/steam_client_publicbeta_ubuntu12 (1).

I think the problem is with Fossilize doing something while decompressing the downloaded files.

Found this while writing this post. https://ask.csdn.net/questions/3196333

Redbatman89 commented 3 years ago

Just wanted to say the the Update for April 12th did nothing to change the situation any better.

class101 commented 3 years ago

I think I somehow fixed my problem here after reading some SSD recommandations for performance.

I realized that a Linux service, fstrim.service, which by default is configured to TRIM drives every week with fstrim.timer to maintain good read-write performance, was not running on my system at all (technically, that's normal because my drives are encrypted in LVM / LUKS, and for security ot paranoid reasons it is not enabled by default and you have to enable this manually to maintain the best performance over time).

If you are not using encryption, this shouldn't be your problem, but still, better to verify the output of the command located in the Exec= variable of the fstrim.service to make sure your drives won't loose write performance over time.

Good article here

Before my write speed was down to a crap speed as low at 70-120 mb/s

As it had been a long time since I had reinstalled my system, I did fresh reinstall and with all ssd performance recommandations applied this time, and I'm back to my expected 500mb/s in read and write (not latest ssd generation, old samsung ssd 850 pro but still good)

So I don't think I will find this problem in a long time because now LVM has now discards enabled and I have set the fstrim service to execute daily.

@Redbatman89

Might be worth trying if your system can be Trimed like that

sudo fstrim /

If it says 'not supported' or something like, then it is not enabled

and to test the write speed of your drive where Steam games are installed

Write speed test

cd /path/to/drive/where/steam/common
dd if=/dev/zero of=benchmark.test bs=2G count=1 oflag=dsync

Discard/TRIM support for solid state drives (SSD)

J0hannaR commented 3 years ago

I was just about to report this bug, then I found this issue here, which is possibly the same one.

Tl:dr: Steam is downloading faster or extracting files after downloading faster than the page cache in RAM gets written onto disk. When the cache is full, Linux switches from non-blocking I/O to blocking I/O, which causes the system to freeze.

Solution: Steam could limit the download speed to file I/O rate and do a regular fsync or some sort of direct write/own caching procedure when downloading/updating apps.

I discovered that when updating Cyberpunk 2077. Download (1.5GB) was fine, but when it's at 100% the system freezes in like 2 minutes intervals and becomes uncontrollable. After reboot, Steam started updating again, but this time a 30 GB update, maybe due to corruption. After the update is at 100%, same behavior.

Reinstalling went fine, but with a similar but different behavior. Steam downloads for half a minute at about 120MB/s, but then the rate goes to 0, system starts freezing again and disk I/O stays high and decreases slowly to 0. Then download goes up again.

The thing is, the update always ends up in a permanent freeze, while re-downloading the whole game worked in the end. My guess is, the 1.5 GB was downloaded completely into my RAM*, and when the update mechanisms starts to decompress and extract the files, page cache gets full, Linux kernel switches to synchronous, blocking IO and freezes. Maybe when doing a full reinstallation the decompressing/extracting already starts while downloading, therefore making it 'bearable', while updating does it after download completion, which impedes the issue.

*with standard manjaro setting, the page cache is 20% of RAM ( /proc/sys/vm/dirty_ratio ), and the interval for flushing to disk is 15 seconds ( /proc/sys/vm/dirty_writeback_centisecs ). So with my 120MB/s download rate and 32GB RAM the update may be completed in RAM only.

So as a temporary solution, reducing my download speed manually in my Steam settings to 20-40 MB/s helped, also playing around with sysctl settings vm.dirty_* . Also activating BFQ I/O may help (https://www.reddit.com/r/Fedora/comments/ay7dkh/linux_large_transfers_freeze_system_high_io/), but I didn't test it.

class101 commented 3 years ago

@J0hannaR

Have you tested your drive write speed is ok ? Because the symptoms you are describing were the same I got but that's was when my drive was slower than a normal hdd.

Test this, (not in /tmp because it is usually a tmpfs into ram memory)

cd /path/to/drive/where/steam/common
dd if=/dev/zero of=benchmark.test bs=2G count=1 oflag=dsync

If you are around 100 Mb/s then yes you will freeze a lot because it is slow.

I did not experience any more freeze now my drive is back to 500 MB/s write speed, but that doesn't mean that Steam works very well on this topic, there are probably improvements as you said

J0hannaR commented 3 years ago

Have you tested your drive write speed is ok ? Because the symptoms you are describing were the same I got but that's was when my drive was slower than a normal hdd.

Yes, I did some intensive benchmarking in the past. So I already know that my old SanDisk SSD Plus is really slow. It's also my fully LUKS encrypted system drive, which certainly doesn't help.

Nevertheless I checked again with dd:

With /dev/zero I get a peak write speed of 340MB/s with a blocksize of 256MB, going higher or lower with blocksize ends up with 120MB/s. I also tested /dev/random, which I think is more similar to compressed data, giving also write rates of 120 MB/s, no matter the block size. When setting the CPU governor to powersave, which I usually have, it even goes further down to 50 MB/s (even though cryptsetup benchmark reports about 2 GB/s for aes-xts with 512B key length).

That's all similar results to my benchmarks in Windows with CrystalDiskMark and AES containers, so yes it's definitively the SSD that's bottlenecking and Steam doesn't seem to take into account that can happen. Admittedly, my setup with a gigabit connection (which is pretty much the best you can get in Germany) and an incredibly slow SSD is a pretty weird and rare combination, I guess.

The same issue when downloading does happen from time to time on my unencrypted storage SSD (Crucial P1 512GB) too though. dd writing from /dev/zero is about 800 MB/s and /dev/random 260 MB/s, so it's technically fast enough. It also is much less severe, since it doesn't freeze my system completely and is a much shorter interval, it also doesn't happen everytime. But those gaps, in which my desktop environment slows down for about 10 seconds, can occur too: gitsteam

Maybe due to some background stuff happening, I don't know.

Redbatman89 commented 3 years ago

So latest steam update yesterday still hasn't fixed this for me, Im thinking it has something to do with Steam still. Also for trim, POP OS automatically has trim enabled by default. i checked and it was already enabled.

Redbatman89 commented 3 years ago

Still no fix after June 7th update.

class101 commented 3 years ago

Also for trim, POP OS automatically has trim enabled by default

Just a side note, every Linux distro has it enabled by default for unencrypted partition by the service fstrim.timer, it is normally set to fstrim once a day.

But it is not enabled for encrypted volume by default.

I discovered that by running sudo fstrim -av, it was only trimming /boot because it was the only part I left unencrypted.

/boot: 1,7 GiB (1801662464 bytes) trimmed on /dev/sda1

I needed to :

and now fstrim works with / too that is encrypted.

/boot: 1,7 GiB (1801662464 bytes) trimmed on /dev/sda1
/: 395,4 MiB (414576640 bytes) trimmed on /dev/mapper/vg0-root

Your problem might be somewhere else but with encrypted volumes it is really important to verify this otherwise your system will never trim and I'm almost sure that's why my drive was down to a crap speed ranging from 50-70Mb/s, now it is always 550 Mb/s as expected and the Steam issue (if there is one) is no more really an issue here.

unclamped commented 2 years ago

After having the same problem, I created an issue in this repo and I was referenced by @kisak-valve to some issues reporting somewhat the same error. After taking a look at the comments here, I found @class101 's TRIM fix to work and make these stutters/freezes hugely disappear. Although I noticed that while I was downloading CS:GO, some very small dips of two or three seconds occurred. Maybe it was my internet and not my entire computer just freezing, but it's better to be safe than sorry by commenting on it.

Hey Kisak, wanted to let you know that none of the issues you referenced in my duplicated issue ended up pointing to this one. In the future, maybe referencing this as well will help other people with the same problem

kgorol commented 2 years ago

I am literally unable to use Steam right now, as installing a new game almost instantly freezes my Steam instance.

If that matters, I am trying to install Titanfall 2 on HDD with high network speed.

userofryzen commented 1 year ago

I'm having this problem too with manjaro stable. It happens since a few updates but until today I have not been able to research a bit. So.. pls, valve, make something. xD I can't almost play because of this. Each time I launch steam my all pc freezes making imposible to do nothing, the problem start after finish downloading too.

gbschenkel commented 1 year ago

Since this is still a issue for some distribution, on Slackware I was able to convince Patrick('the boss') to enable on default in kernel see here and here. Then in Slackware 15.0 we got autogroup enabled on kernel by default.

Automatic process group scheduling (SCHED_AUTOGROUP)

CONFIG_SCHED_AUTOGROUP:

This option optimizes the scheduler for common desktop workloads by
automatically creating and populating task groups. This separation
of workloads isolates aggressive CPU burners (like build jobs) from
desktop applications. Task group autogeneration is currently based
upon task session.

Symbol: SCHED_AUTOGROUP [=y]
Type : bool
Defined at init/Kconfig:1205
Prompt: Automatic process group scheduling
Location:
-> General setup
Selects: CGROUPS [=y] && CGROUP_SCHED [=y] && FAIR_GROUP_SCHED [=y]

Like my post before https://github.com/ValveSoftware/steam-for-linux/issues/7720#issuecomment-823010382, fossilize try use this kernel feature, which when is not enabled it use the fallback option doing all the trouble you guys are experiencing. First this is not a Steam issue, is your distro issue, you guys need enable the kernel feature 'autogroup' some how on your distro, recompiling the kernel, or grabbing a custom kernel from someone who has enable it.

gbschenkel commented 1 year ago

I also like to advice to you guys(users) to enable the PREEMPT_VOLUNTARY=y on kernel.

Voluntary Kernel Preemption (Desktop)
          This option reduces the latency of the kernel by adding more
      "explicit preemption points" to the kernel code. These new
      preemption points have been selected to reduce the maximum
      latency of rescheduling, providing faster application reactions,
      at the cost of slightly lower throughput.

      This allows reaction to interactive events by allowing a
      low priority process to voluntarily preempt itself even if it
      is in kernel mode executing a system call. This allows
      applications to run more 'smoothly' even when the system is
      under load.

      Select this if you are building a kernel for a desktop system.

If your kernel is compiled with CONFIG_PREEMPT=Y and PREEMPT_DYNAMIC=y, both enabled, you can enable the PREEMPT_VOLUNTARY just putting the preempt=voluntary on lilo / grub / elilo default boot parameter:

Example using Grub: Edit the /etc/default/grub and append as shown below the flag preempt=voluntary. GRUB_CMDLINE_LINUX_DEFAULT="preempt=voluntary"

For Steam employees, please try add this information to the documentation of give a warning when using Steam without this and Autogroup enabled, mainly when Autogroup is not enabled. Preempt help me with issues with low input response on controllers.

userofryzen commented 1 year ago

@gbschenkel In my distro autogrups is enabled, manjaro. And preempt dynamic too. The only thing that is not enable by default I think is the voluntary thing, I'll test it.. But anyways steam was freezing my pc with those things enabled in kernel...

gbschenkel commented 1 year ago

@gbschenkel In my distro autogrups is enabled, manjaro. And preempt dynamic too. The only thing that is not enable by default I think is the voluntary thing, I'll test it.. But anyways steam was freezing my pc with those things enabled in kernel...

Try execute Steam from shell, wait for it stop, after all that Installing breakpad exception handler for appid. Try do some deleting/installing the games which do some the freezing, I hope you have some little size game to test it, check on the shell what Steam is trowing out.

In my case, Fossilize before enabling Autogroups was writing on shell: Fossilize INFO: Autogroup scheduling is not enabled on this kernel. Will rely entirely on nice(). after enable it change to Fossilize INFO: Setting autogroup scheduling. and the problem stopped.

userofryzen commented 1 year ago

Replying to https://github.com/ValveSoftware/steam-for-linux/issues/7720#issuecomment-1249960820

nope, autogroup was enabled yesterday and another one when I had the problems so there has to be another problem.

gbschenkel commented 1 year ago

Well I think is need to check all kernel config, to find out why this is happening, I am adding the default Slackware kernel config, you may do a diff to find out what is different. https://pastebin.com/AgjUe2Fg