Nathan's Lucubrations

22 04 2011

Fri, 22 Apr 2011

Usability, cron and nice

So I'm typing along, when all of a sudden, my system comes to a crawl. Windows go blank, apps don't respond to key presses. Normally, I wouldn't be surprised. But wait a moment; this isn't Windows or OSX; it's Linux. WTF is going on? I check top:

top - 08:04:54 up 32 days, 21:15, 15 users,  load average: 6.06, 3.74, 1.92
Tasks: 205 total,   1 running, 203 sleeping,   0 stopped,   1 zombie
Cpu(s):  1.6%us,  1.3%sy,  0.0%ni,  0.0%id, 97.1%wa,  0.0%hi,  0.0%si, 0.0%st
Mem:   4107088k total,  2512484k used,  1594604k free,   420900k buffers
Swap:  2654200k total,   450656k used,  2203544k free,   462820k cached

 2569 root      20   0  140m  51m  12m S    3  1.3 322:06.24 Xorg
  768 npsimons  20   0  190m  21m  10m S    1  0.5   5:36.34 gnome-panel
  355 root      20   0     0    0    0 S    0  0.0 127:30.59 kcryptd
 3454 npsimons  20   0  132m 8868 5948 S    0  0.2   4:51.28 metacity
 4011 npsimons  20   0  134m  10m 6112 S    0  0.3   4:09.77 gnome-terminal
11960 root      30  10  2328 1180  488 D    0  0.0   0:02.63 sxid

The one thing that catches my eye is sxid, a security checking program I installed that automatically checks changes in status or permission on suid executables. But why is it running now, instead of late at night when I'm not around? Checking /etc/crontab, I find this:

25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

WTF?! Who thought it was a good idea to start cron jobs at 06:30? And the entries for weekly and monthly are similar. Okay, simple, change them to slightly after midnight; if I'm still on the computer by then, that will be my indication to go to bed.

But then I have another thought: there's plenty that gets run from cron, and only sxid is causing problems; why? sxid is fairly new, but it should at least have a crontab that nice's it properly, right? No:



if [ -x /usr/bin/sxid ]; then
	/usr/bin/sxid ${SXID_OPTS}

Programmers/packagers, here's a hint: even though your software may be "system" software that runs in the background, you still need to think of usability. Don't be like Symantec. This isn't Windows or iOS; our OS *can* walk and chew bubble gum at the same time. Don't abuse the privilege, and take a look at other cron scripts where use of nice(1) and ionice(1) are standard.

And yes, I should probably send a patch instead of just bitching. Just for reference, here's how I fixed it (which I partially cut and pasted from the debsums daily crontab):



if [ -x /usr/bin/sxid ]; then
	nice -n 19 ionice -c 3 /usr/bin/sxid ${SXID_OPTS}

posted at: 08:50 | path: | permanent link to this entry

powered by blosxom