Steam for Linux > Limited Beta > Topic Details
jay Nov 22, 2012 @ 1:23pm
Issue report: Steam uses 100% CPU if and only if TF2 is running
While I've posted about this issue on a couple of other threads, there does not seem to be a dedicated thread for this problem.

Steam in general works fine for me; however, when starting TF2, the Steam process suddenly uses 100% CPU. TF2 itself works, it's just very slow (I'm assuming due to the processor load caused by Steam). Once TF2 has shut down, Steam's load returns to normal.

This only occurs while TF2 is running, and does not happen with other games or while no game is started.

If I can be of any help tracking this issue down or if you need further information, please let me know. I already tried doing a valgrind session, but ran into issues because it didn't like the 32bit binary.

My system info:

Processor Information:
Vendor: GenuineIntel
Speed: 2997 Mhz
2 logical processors
2 physical processors
HyperThreading: Unsupported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Unsupported
SSE41: Unsupported
SSE42: Unsupported

Network Information:
Network Speed:

Operating System Version:
Linux (64 bit)
Kernel Name: Linux
Kernel Version: 3.6.7-1-ARCH
X Server vendor: The X.Org Foundation
X Server release: 11300000

Video Card:
Driver: NVIDIA Corporation GeForce GTX 660/PCIe/SSE2

Driver Version: 4.3.0 NVIDIA 310.19
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 60 Hz
VendorID: 0x10de
DeviceID: 0x11c0
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 1920 x 1080
Primary Display Size: 20.51" x 11.54" (23.50" diag)
52.1cm x 29.3cm (59.7cm diag)
Primary Bus: PCI Express 16x
Primary VRAM: 2048 MB
Supported MSAA Modes: 2x 4x 8x 16x

Sound card:
Audio device: ICE1712 - multitrack

Memory:
RAM: 5973 Mb

Miscellaneous:
UI Language: English
LANG: en_US.UTF-8
Microphone: Not set
Total Hard Disk Space Available: 404932 Mb
Largest Free Hard Disk Block: 15763 Mb

Installed software:

(Note that the information is partially incorrect; for instance, I use audio output over HDMI.)

Partially related threads:
http://steamcommunity.com/app/221410/discussions/1/882965239857672788/
http://steamcommunity.com/app/221410/discussions/1/882966056634347830/
http://steamcommunity.com/app/221410/discussions/1/882965239732837463/
Last edited by jay; Nov 22, 2012 @ 1:35pm
Showing 1-15 of 54 comments
< >
§§ Sno |Alpha Wolf| Nov 22, 2012 @ 2:14pm 
Same issue here.

Processor Information:
Vendor: GenuineIntel
Speed: 3192 Mhz
4 logical processors
3 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Unsupported
SSE41: Supported
SSE42: Supported

Network Information:
Network Speed:

Operating System Version:
Ubuntu 12.10 (64 bit)
Kernel Name: Linux
Kernel Version: 3.5.0-19-generic
X Server vendor: The X.Org Foundation
X Server release: 11300000

Video Card:
Driver: ATI Technologies Inc. AMD Radeon HD 6800 Series

Driver Version: 4.2.11978 Compatibility Profile Context
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 60 Hz
VendorID: 0x1002
DeviceID: 0x6739
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 1920 x 1080
Primary Display Size: 18.74" x 10.55" (21.50" diag)
47.6cm x 26.8cm (54.6cm diag)
Primary VRAM Not Detected

Sound card:
Audio device: Realtek ALC887

Memory:
RAM: 7913 Mb

Miscellaneous:
UI Language: English
LANG: en_US.UTF-8
Microphone: Not set
Total Hard Disk Space Available: 28805 Mb
Largest Free Hard Disk Block: 8213 Mb
Ebola in Doritos (Towers) Nov 23, 2012 @ 4:18am 
I believe this happens independent of kernel, operating system, and drivers:

Self cross-post from Issue Report: Steam seamingly idle-looping on XGetWindowAttributes():
Originally posted by My Little Palestinian:
I have to say, this is a pretty annoying problem. While it didn't affect my performance from point of view, but it did raise my CPU temperature to the 60-70C range.

I attempted to write a shell script to work around this problem and throttle the process, but Team Fortress 2 some how depends on Steam, frame-by-frame. Even a microsecond without it, and it stutters.

#!/bin/bash
STEAMID=$(pidof steam)
TEAMFORT=$(pidof hl2_linux) #Just making sure that we're not being stopped as well.

while true;
do
kill -SIGSTOP $STEAMID; kill -SIGCONT $TEAMFORT; sleep 1; kill -SIGCONT $STEAMID; sleep 0.1;
done

Edit & Improved Workaround:
I modified the workaround by stopping and continuing the process about 15 milliseconds long, which is about the refresh rate for 60hz (16.(6)ms to be exact) monitors. I managed to keep my CPU at around 50C on a 24 player 2fort server.

#!/bin/bash
STEAMID=$(pidof steam)

# set the lowest possible priority for steam, might not be a good idea since pauses might be longer than 16ms
renice 19 -p $STEAMID

# since the fps we want is 60, 1000 (ms ticks) divided by 60(fps) is 16.6ms
# I approximate to 0.015 to minimize stuttering
# Keep in mind calling these commands is an asynchronous task so we might want to lower our amount to sleep
while true;
do
kill -SIGSTOP $STEAMID; sleep 0.015; kill -SIGCONT $STEAMID; sleep 0.015;
done

It's really crappy and inefficient due to its asynchronous nature. The syntax and formatting only works in bash, and I'm too lazy to correct it for the dash shell.

It's not even a workaround in the absolute sense to be honest, it just makes the problem have a smaller impact.
Last edited by Ebola in Doritos (Towers); Nov 23, 2012 @ 4:23am
Julian Fernandes Nov 23, 2012 @ 4:31am 
It also happens here. Tried with kernel 3.2, 3.5 and 3.7 RC6 on Ubuntu 12.10 and Ubuntu 12.04.

Oddly enough, when I tried with ElementaryOS Luna (first beta), it stopped and I could enjoy TF2 without lags, since Steam stopped using all the CPU. Luna doesn't use Compiz, it uses Gala, but I don't think it's related.

Tryed the "steam-login" project, that uses the XFCE DE and it happens there too. I don't remember if XFCE uses Compiz, but if it does, could be related.

Processor Information:
Vendor: GenuineIntel
Speed: 2301 Mhz
4 logical processors
2 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Unsupported
SSE41: Supported
SSE42: Supported

Network Information:
Network Speed:

Operating System Version:
elementary OS Luna (64 bit)
Kernel Name: Linux
Kernel Version: 3.5.0-18-generic
X Server vendor: The X.Org Foundation
X Server release: 11203000

Video Card:
Driver: Intel Open Source Technology Center Mesa DRI Intel(R) Sandybridge Mobile x86/MMX/SSE2

Driver Version: 3.0 Mesa 9.1-devel
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 59 Hz
VendorID: 0x8086
DeviceID: 0x116
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1440 x 900
Desktop Resolution: 1440 x 900
Primary Display Size: 14,57" x 9,13" (17,17" diag)
37,0cm x 23,2cm (43,6cm diag)
Primary VRAM Not Detected

Sound card:
Audio device:

Memory:
RAM: 3868 Mb

Miscellaneous:
UI Language: English
LANG: pt_BR.UTF-8
Microphone: Not set
Total Hard Disk Space Available: 441292 Mb
Largest Free Hard Disk Block: 366746 Mb
Last edited by Julian Fernandes; Nov 23, 2012 @ 5:09am
AnAkkk Nov 23, 2012 @ 4:38am 
I have exactly the same issue.
SUSEd Nov 23, 2012 @ 5:21am 
It happens for me too. Steam utilizes 100% even on quad-core CPU. This means it loads 1 CPU core.
SUSEd Nov 23, 2012 @ 6:15am 
Originally posted by My Little Palestinian:
I believe this happens independent of kernel, operating system, and drivers:

Self cross-post from Issue Report: Steam seamingly idle-looping on XGetWindowAttributes():
Originally posted by My Little Palestinian:
I have to say, this is a pretty annoying problem. While it didn't affect my performance from point of view, but it did raise my CPU temperature to the 60-70C range.

I attempted to write a shell script to work around this problem and throttle the process, but Team Fortress 2 some how depends on Steam, frame-by-frame. Even a microsecond without it, and it stutters.

#!/bin/bash
STEAMID=$(pidof steam)
TEAMFORT=$(pidof hl2_linux) #Just making sure that we're not being stopped as well.

while true;
do
kill -SIGSTOP $STEAMID; kill -SIGCONT $TEAMFORT; sleep 1; kill -SIGCONT $STEAMID; sleep 0.1;
done

Edit & Improved Workaround:
I modified the workaround by stopping and continuing the process about 15 milliseconds long, which is about the refresh rate for 60hz (16.(6)ms to be exact) monitors. I managed to keep my CPU at around 50C on a 24 player 2fort server.

#!/bin/bash
STEAMID=$(pidof steam)

# set the lowest possible priority for steam, might not be a good idea since pauses might be longer than 16ms
renice 19 -p $STEAMID

# since the fps we want is 60, 1000 (ms ticks) divided by 60(fps) is 16.6ms
# I approximate to 0.015 to minimize stuttering
# Keep in mind calling these commands is an asynchronous task so we might want to lower our amount to sleep
while true;
do
kill -SIGSTOP $STEAMID; sleep 0.015; kill -SIGCONT $STEAMID; sleep 0.015;
done

It's really crappy and inefficient due to its asynchronous nature. The syntax and formatting only works in bash, and I'm too lazy to correct it for the dash shell.

It's not even a workaround in the absolute sense to be honest, it just makes the problem have a smaller impact.

I launched this script and CPU loading of steam process lowered from 100 to 52-56%. How to launch it automatically after TF2 launching?
AnAkkk Nov 23, 2012 @ 7:18am 
Thanks for the script! By running it Steam was using 50% CPU for me as well, instead of 100%. I did some benchmarks again:

Timedemo results:
Ubuntu 12.10 64bit:
75 FPS (with Steam using 100% CPU)
76 FPS (with Steam using 100% CPU)
93 FPS (with Steam using 50% CPU)
96 FPS (with Steam using 50% CPU)
Last edited by AnAkkk; Nov 23, 2012 @ 7:21am
Ebola in Doritos (Towers) Nov 23, 2012 @ 3:25pm 
Originally posted by shished:
I launched this script and CPU loading of steam process lowered from 100 to 52-56%. How to launch it automatically after TF2 launching?
If your window manager supports alt+tabbing from a fullscreen application like Team Fortress 2, I'd just execute it in the console. I didn't think about doing that since XFWM works really well with fullscreen applcations.

I also modified the script to let steam continue after you send ctrl+c to end the script:

#!/bin/bash

# Written by maccer_tw <colourless.stick@gmail.com>

STEAMID=$(pidof steam)

trap 'echo "SIGINT: Interrupt catured. Restoring process"; kill -SIGCONT $STEAMID; exit 0; ' 2

if [ -z "$STEAMID" ];
then
echo "Couldn't detect Steam. Is it running?"
exit 1
else
echo "Setting steam process to the lowest priority possible..."
# set the lowest possible priority for steam, might not be a good idea since pauses might be longer than 16ms
renice 19 -p $STEAMID
fi


# since the fps we want is 60, 1000 (ms ticks) divided by 60(fps) is 16.6ms
# I approximate to 0.015 to minimize stuttering
# Keep in mind calling these commands is an asynchronous task so we might want to lower our amount to sleep
echo "Entering throttle section."
while true;
do
kill -SIGSTOP $STEAMID; sleep 0.015; kill -SIGCONT $STEAMID; sleep 0.015;
done

You could also keep it running before Team Fortress 2, as it only throttles Steam.
Last edited by Ebola in Doritos (Towers); Nov 23, 2012 @ 3:47pm
AnAkkk Nov 28, 2012 @ 9:46am 
Looks like this hasn't been fixed by the last update.
Superice97 Nov 28, 2012 @ 1:07pm 
It's definitely not a compiz problem. The same thing happens in LXDE. I never realized it because my computer has a great graphics card, but Valve should work on this because on slower computers it can destroy the performance and it can also kill battery life on laptops (I usually don't run on battery, and never while gaming).
LinuxGamer Nov 29, 2012 @ 4:51am 
Glad to see this issue is reported. I'm experiencing the same symptoms. It occurs when connecting to a server, and also periodically during gameplay. Gameplay on my system seems to be unaffected (It's liquid smooth and at least 85 fps), however the cpu is obviously under higher than normal load, and I get up to 55C pretty fast on my i5-2500k. In wine it hovers around 45C. It feels to be under about double the load I get when running under Wine.

Running gnome-fallback and/or gnome-shell system info: http://pastebin.com/NkdSgpJU
I did some testing and the terminal output isn't much help. The offending culprit threads are two processes "MainThrd", which are both using around 50% cpu. Fullscreen/windowed didn't seem to affect it, as well as toggling between "multi-threads" in the tf2 settings menu.
Last edited by LinuxGamer; Nov 29, 2012 @ 5:04am
scott_test123 Nov 29, 2012 @ 1:41pm 
We're aware of this problem and it is high on our list to fix. Thank you for reporting it.
[Linux] Schrödinger's cat Nov 29, 2012 @ 8:58pm 
You should put all your efforts to fix this - it's kinda hard to test if you can't actually test
AnAkkk Dec 8, 2012 @ 1:20am 
Not fixed after the latest updates.
[Linux] Schrödinger's cat Dec 8, 2012 @ 7:17am 
I think it got even worse
Showing 1-15 of 54 comments
< >
Per page: 15 30 50