Jump to content

Slight freeze every 5 seconds (or so)


Recommended Posts

In both vanilla installs and modded installs I encounter a constant and steady freezing for a fraction of a second every 5 to 7 seconds or so. It has become quite an annoyance as it also occurs on the VAB which makes assembly a task rather than a treat. I might also add that over time the freezes tend to give me a headache.

I am running a i5-4670k with a GTX 980

I use both standard launch and I also use OpenGL.

I am constantly experiencing this.

Is there a solution?

Link to comment
Share on other sites

That's usually what you get when the engine is trying to render huge number of parts, but unless you are building a MASSIVE ship, you shouldn't experiment this in VAB.

My guess would be to check if there is something else on your computer sucking up ressources... look at the task manager while playing and try to spot if a process wake up every 5 secs. Activating IO Read/Write info in the task manager would also help spotting a process spinning the disk, it can be selected in view -> column.

Link to comment
Share on other sites

If it's what it I think it is... welcome to the club, it does this on GNU/Linux also (& I have very similar hardware).

I was wondering if it's like that on Windoze too, now I know :)

Same with both DirectX & OpenGL?

Assuming it's not some background process, or as wibou suggested, disk I/O (in my case it's not AFAICT, also KSP loads everything into RAM anyway);

Worse with mods?

Worse with higher part counts?

Otherwise silky framerate?

The only thing I can put it down to is Unitys garbage collection, not really something anyone but Unity can fix. There's much complaining on the Unity forums...

I had a go recompiling Unitys mono build with multithreading enabled for the garbage collector - it practically eliminates the freezing but also introduces a nasty memory leak :(

If anyone has any better ideas I'd be all ears, it's very annoying.

Edited by steve_v
Link to comment
Share on other sites

In terms of background processes nothing else is running. Kerbal runs on an SSD separate from any other activity. I have run it on both a samsung 840 evo and a samsung 850 pro with the same results. I have no HDD to check...

I will get this stuttering in the VAB without placing a SINGLE part.

Honestly I've been playing Kerbal for about a year and a half and ever since like 23.5 I've been having this issue and it makes the game physiologically uncomfortable to play.

Edited by SessoSaidSo
Link to comment
Share on other sites

I use Linux and have similar hardware (i7-3820QM 2.70GHZ and NVIDIA Quadro K1000M) and everything is fine so it is doubtful this is caused by the hardware (unless you both use outdated Nvidia driver?).

That sound like a garbage collector issue in Unity, it would make sense... but then I don't understand why more people don't have the issue.

How much RAM do you have, guys? Are you using the 32 bits or the 64 bits version?

Link to comment
Share on other sites

I'm seeing this too. Ubuntu 14.04, i7-4790K, 16GB, 64bit, NVIDIA 340.36 (but it also happens with 331.113). There's an SSD on the compute but KSP is on an HD. I don't think it's anything else running on the computer that's causing the problem: I tried boosting the priority to the maximum (renice -20) and still saw the stuttering. I did notice it was much less )but still present) on a new 0.90 install compared with my older heavily modified 0.23, but not sure whether it's the mods or the newer version that helps. I'll experiment more...

Link to comment
Share on other sites

I've experienced the same thing (i7-3820, 32g, 670 GTX, SSD, Win7 64-bit, 32-bit KSP) - I've noticed it's more likely to show up if KSP has been running for a while, and generally, restarting KSP helps there.

NB: Sometimes it happens for other reasons (errors, mods, heavy background load outside of KSP, etc), but other times, it appears in pure stock games with absolutely no explanation.

(That garbage collection theory sounds like it would fit the circumstances)

Link to comment
Share on other sites

I've been annoyed by this, usually in flight. (i5-3570, 16GB, nVidia 660, SSD, Win8.1 64bit, 32-bit KSP) From taking off in airplanes (under power, SAS/RCS, lots to calculate), to fairly passive parachute landing at KSC with less than 200 parts in the scene. Only mods i'm using are 2 of Claw's fixes (AnchoredDecouplerFix, EVAEjectionFix)

I've noticed it's more likely to show up if KSP has been running for a while, and generally, restarting KSP helps there.
Sadly yes :(.
Link to comment
Share on other sites

well is there a way to disable garbage collection or something like modify it? (may be a stupid question) I have tried now installing on 3 separate ssd's and I get the same results. Of course this issue expands the more mods are used.

Link to comment
Share on other sites

It's the Unity scripting language doing garbage collection, in an exceptionally poor manner. When it gets especially bad in the VAB, I save the ship, start a new ship, then reload, and it will go for a while without much skipping.

It's really bad when it happens in flight, as events in the game continue during the pause, so you can be throttled up for a burn, have the screen freeze for a second, and suddenly be well past the point where you wanted to kill the throttle. So if it's happening before a burn, leave the game and come back, and it might be mitigated.

Link to comment
Share on other sites

Have you folks tried disabling VSync, both in the game's settings and your graphics card's control panel?

Of course, first thing I checked. I have vsync off for everything but fullscreen video playback anyway. Even tried it in a clean xsession with no DE.

FWIW, having other things chewing on the CPU / GPU - niced background processes / desktop compositing etc. have little to no impact, prioritising the KSP process itself (nice -10) yields some improvement but it's minimal.

I'll add that this seems to be exacerbated by mods that run code - (i.e. plugins) particularly those that draw something to the screen, but not by part-only addons. As already covered, this is not a mod issue per-se, as it also occurs in the stock game.

Edited by steve_v
Scratch that, more testing reqd.
Link to comment
Share on other sites

Hey guys. I'm also suffering exactly what is described here. Glad to see its not just me, I was considering re-installing windows to see if that helped! It's virtually made the game unplayable, only small craft are fun to work with and even they have the stutter its just less noticeable. Where I notice it the most is when panning the camera around the craft, it will suddenly freeze and then when it catches up your right round the other side of the craft, same thing happens in the editors too.

So quite a lot of you seem to be pointing fingers at the unity GC. That kinda feels right. My only question to that is, why didn't I suffer this before? I think I started noticing this in the previous version, but then I was running with lots of mods and was sure that was why. Now I'm playing almost stock (stock + procedural fairings and MJ) and its still present (present in pure stock, worse with MJ installed). In versions before the last two I've built large (400+) part craft in very modded installs and while I've had low frame rates with some craft I've never had this "slight-freeze" issue (which is far worse imho). So is it a new issue in unity (and when did KSP last update unity?)

The other thing I've noticed which may or may not be connected is my system running out of memory. This is with 16GB of RAM, and after closing all but background processes. And the oddest thing; the sum of the memory used by everything shown (including from all users) does not come anywhere near to the total amount of RAM being used. It's almost exactly like something's GC didn't do its job! (and windows doesn't seem to care to clean it up either).

Clearly quite a few of us are suffering this so it is a thing. Has a report been made on the bug tracker yet?

there is also a slight freeze for me when I check my remaining electricity charge in rovers, some of the time it even led to crash... do you think it's possibly related?

It maybe, but I think the slight-freeze we're getting feels more like a pulse than happening as a result of an action. I have noticed a sometimes long freeze (that has once caused a crash) when, even momentarily, mousing over the contracts tab (which is right next to the fuel tab). Maybe that was the cause of your freeze?

Seems to be worse when you have lots of contracts on the go as I didn't notice it early in the game. Anyway, that was the next thing I was going to make a report on.

Link to comment
Share on other sites

I just tested this tonight. I built a brand new rig (I'm not rich, I just work at Tigerdirect), it was pretty low tech being an A10-7850k with 4GB of ram on a 128 Corsair GS. I loaded what is essentially a copy paste of my modded Kerbal game data file. Of course the game was quite laggy but I did not experience the massive and noticeable freezes.

The issue happens with both SSD's of all types and HDD's so I think it narrows that out. I have had the issue on win 7 home/pro and windows 8.1 home/pro. The amount of ram seems to be a non-issue. This really narrows iut down to CPU, GPU, or MOBO.

Caught this on tape! - proof of the Freeze!

Edited by SessoSaidSo
Link to comment
Share on other sites

Hey guys. I'm also suffering exactly what is described here. Glad to see its not just me, I was considering re-installing windows to see if that helped! It's virtually made the game unplayable, only small craft are fun to work with and even they have the stutter its just less noticeable. Where I notice it the most is when panning the camera around the craft, it will suddenly freeze and then when it catches up your right round the other side of the craft, same thing happens in the editors too.

So quite a lot of you seem to be pointing fingers at the unity GC. That kinda feels right. My only question to that is, why didn't I suffer this before? I think I started noticing this in the previous version, but then I was running with lots of mods and was sure that was why. Now I'm playing almost stock (stock + procedural fairings and MJ) and its still present (present in pure stock, worse with MJ installed). In versions before the last two I've built large (400+) part craft in very modded installs and while I've had low frame rates with some craft I've never had this "slight-freeze" issue (which is far worse imho). So is it a new issue in unity (and when did KSP last update unity?)

The other thing I've noticed which may or may not be connected is my system running out of memory. This is with 16GB of RAM, and after closing all but background processes. And the oddest thing; the sum of the memory used by everything shown (including from all users) does not come anywhere near to the total amount of RAM being used. It's almost exactly like something's GC didn't do its job! (and windows doesn't seem to care to clean it up either).

Clearly quite a few of us are suffering this so it is a thing. Has a report been made on the bug tracker yet?

It maybe, but I think the slight-freeze we're getting feels more like a pulse than happening as a result of an action. I have noticed a sometimes long freeze (that has once caused a crash) when, even momentarily, mousing over the contracts tab (which is right next to the fuel tab). Maybe that was the cause of your freeze?

Seems to be worse when you have lots of contracts on the go as I didn't notice it early in the game. Anyway, that was the next thing I was going to make a report on.

Lots of textures being loaded on demand (it shouldn't be doing that. ?!?!) leads to high memory usage, so the GC gets called more often to make sure that KSP doesn't run out of memory. Apparently the GC blocks the threads so everything stops for a split second. GC has to go through all that RAM to find stuff to remove, so it takes a while (overclock GPU RAM and onboard RAM?). Some scripts find that their stuff got GC'd so it has to be reinitialized on next frame. Or it ended up on the page file, your choice.

Clearly Unity's garbage collector cannot get any more inefficient.

Link to comment
Share on other sites

Not that I really know much about unity but been having a dig around. Am I right in thinking that KSP is now on Unity 4.0 (and that was as of v0.18.4)?

So looking through the change logs for Unity from v4.0.1 to 4.6.1 I found a couple mentions of improvements to the GC.

Resources.UnloadUnusedAssets() has been rewritten. It is around 4x faster than in Unity 4.0 and works much better in a game that streams levels in and out. The unloading is now using precise garbage collection (previously it was based on Mono's built-in GC, which is conservative). Fixes strange corner cases with the old system, where in the worst case it could reload prefabs from disk during unloading.

Scripting: Avoid pausing some threads during Mono garbage collection on Windows, OS X, and iOS. Helps prevent audio stutters during GC.

Native Client: Fixed asset garbage collection not to incorrectly collect assets which were still being referenced.

(unity change logs)

These sound like they might address our stuttering issue.

So if we are still on Unity 4.0, then according to the KSP change log that was done almost 2 years ago. Maybe its time for a unity upgrade, at least to 4.2? Is a 4.x upgrade being talked about (I know v5 is being talked about, but that's not out yet).

Link to comment
Share on other sites

  • 2 weeks later...
Have you folks tried disabling VSync, both in the game's settings and your graphics card's control panel?

Does this mean the stutter is not supposed to happen, as in 'Squad has never noticed it'? Is KSP tested on a minimum specs PC at all?

Link to comment
Share on other sites

okay reading some setups here, I consider my rig pretty damn mediocre:

phenom 8400 tripple 2,1GHz; 4GB RAM; Radeon HD 6450; Win 7 64Bit

KSP 0.90 with KER, RT2, KAC, KAS

I don't have regular stutter problems as you discribed. even the horizon lag disappeared with .90.

only thing is a short hang/ pause/ almost crash in flight when I first mouseover the missions tab...

are you sure your CPU or GPU aren't throttled down? it also helps if you assign KSP to one CPU core only and try to get everything else off that core.

Link to comment
Share on other sites

are you sure your CPU or GPU aren't throttled down?

I am sure.

it also helps if you assign KSP to one CPU core only and try to get everything else off that core.

I tried cpu affinity (and priority), only difference is that the interval is longer (about 15 seconds).

I have no clue how to get everything else off that core. Manually configure each process? If that's actually necessary to have the game run properly, it's a lot of hassle.

Link to comment
Share on other sites

I tried cpu affinity (and priority), only difference is that the interval is longer (about 15 seconds).

I have no clue how to get everything else off that core. Manually configure each process? If that's actually necessary to have the game run properly, it's a lot of hassle.

actually that's what I had to do for one save a few versions ago. I put KSP on realtime priority on CPU0, killed all non essential processes and shoveled the rest on to the remaining cores. manually, in taskmgr...

a slimmed down OS (dedicated to play KSP and KSP only) on another boot-slot could help...? I'd like to say something about boot-disks, but that was two decades ago.

Link to comment
Share on other sites

CPU0 is likely not the best choice to put KSP on, since it tends to be more or less reserved for system processes when they need to run. It's usually better to throw KSP to a lesser-used core and then make sure nothing else will use it.

Link to comment
Share on other sites

CPU affinity does not solve the problem anyway. And i don't want to jump through any more hoops getting it to work properly. I'll take my chances waiting for Squad to fix it.

I noticed though that the one entry in the bug tracker about this issue is marked "duplicate" and "100% resolved". Doesn't look like my chances are very good...

Bug #530 Framedropping with sound crackling

http://bugs.kerbalspaceprogram.com/issues/530

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...