Freezing the desktop every second (like clockwork)

freezegentooxorg

Recently, after using my desktop machine for a day or so, the oddest thing will start happening: Every second, the desktop will briefly freeze, then continue, like a heartbeat. The interval is one second exactly —I measured with a stopwatch— though every six or seven seconds, it will skip a beat.

Any audio will continue normally, as will the mouse-pointer. The rest freezes, which is particularly noticeable with running video and text-editing. But it's only within X; the tty1 terminal doesn't suffer from this. And restarting X will temporarily fix the problem.

The regularity of this occurrence, as well as the fact that I always have plenty of free memory and idle cores left, makes me suspect that some process is running on a timer, co-opting the video-card. But I can't figure out what it is. I can't find anything useful in the dmesg or X logs.

Here is some info that might be useful (let me know if I should add more):

  • Distro: Gentoo Linux (kernel: linux-3.7.1-gentoo)
  • Desktop: Gnome3
  • CPU: Intel Core i7 (quadcore)
  • VGA: GeForce 9500 GT (driver: Nouveau 1.0.8)

It's probably overpowered for the general multitasking I use it for.

I know my kernel is somewhat out-of-date, but I think I'd actually be a bit frustrated if a kernel update fixed the problem, because then I'll never know what caused it. 🙂

Any ideas?

Best Answer

Periodic freezes are in my experience usually caused by the hard disk. Check your hard disk status with smartctl:

smartctl -a /dev/sda | less

Also run a selftest (that will take a few hours):

smartctl -t long /dev/sda

Later query it with smartctl -a again to see the result.

Also check your dmesg output, there could be error messages that could point you in the right direction.

Related Question