Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: One solution to a launchd-cron CPU usage issue System 10.4
Tiger only hintAfter upgrading to 10.4, I found that launchd was eating up much CPU time (around 15%).

Investigating this strange behavior, I noticed that cron was started several times per second! The file com.vix.cron.plist (in /System -> Library -> LaunchDaemons) responsible for cron contains this entry:

  <key>QueueDirectories</key>
  <array>
    <string>/var/cron/tabs</string>
  </array>
This causes cron to watch the /var/cron/tabs directory for new crontabs, which is a good thing. But in my case, this directory also contained a .DS_Store file. The Finder uses this file to store various information such as window location, icon position, etc. For some reason, launchd choked on this file, even though it was never updated. After removing the file with sudo rm -f /var/cron/tabs/.DS_Store, I found that launchd behaved as expected, and CPU usage was back to normal.

As always, please be extremely careful when using rm -f as root (sudo), as you can do much damage to important files and directories with just one typo!
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[11,728 views]  

10.4: One solution to a launchd-cron CPU usage issue | 8 comments | Create New Account
Click here to return to the '10.4: One solution to a launchd-cron CPU usage issue' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: One solution to a launchd-cron CPU usage issue
Authored by: adrianm on Sep 15, '05 10:38:38AM

This should serve as a warning to all those people who use the Finder to explore folders that were never really meant to be explored in that way.



[ Reply to This | # ]
Finder problem?
Authored by: googoo on Sep 15, '05 12:50:01PM

I agree that there are problems that occur when you use the Finder to explore outside the normal user directories, but I think that a more desirable solution would be for Apple to fix the Finder so that it does not muck up the system files. Why should there be directories that are not meant to be explored by the Finder?

-Mark

PS. Disclaimer: I usually (but not always) use the Terminal to look at these "Finder-unfriendly" directories.



[ Reply to This | # ]
Finder problem?
Authored by: TvE on Sep 16, '05 12:17:54PM
…i think that a more desirable solution would be for Apple to fix the Finder so that it does not muck up the system files…

You're wrong: No system files were modified(!) - there was ADDED a file to a - for the Finder - invisible folder

…Why should there be directories that are not meant to be explored by the Finder?…

Why? - Beacuse you can then avoid the problem described in this thread ;-)

[ Reply to This | # ]
10.4: One solution to a launchd-cron CPU usage issue
Authored by: alan-trewartha on Sep 19, '05 09:40:17AM

i don't know for sure in tiger, but in 10.3 /var/cron and /var/cron/tabs are ROOT access only. so if you've managed to make a .DS_store file in finder then you've not only got a GUI finder session logged in as admin,but as the ROOT user!

DO NOT DO THIS. in fact, how on earth did you manage this? when you've worked that out, stop it. :-)



[ Reply to This | # ]
misusing root
Authored by: sjk on Sep 19, '05 08:04:51PM

Yeah, running Finder as root or logging in with a root GUI can have undesirable side effects, like creating .DS_Store files where they don't belong. Or unexpectedly creating other root-owned files that a non-root user will have trouble accessing (reading and/or writing) later. In general, I recommend skeptically questioning anyone who suggests logging in as root to "fix" a problem.



[ Reply to This | # ]
10.4: One solution to a launchd-cron CPU usage issue
Authored by: shoelzer on Sep 15, '05 03:10:45PM
I believe I know what happened to the postee.

The QueueDirectories key in the plist tells launchd to monitor that folder and run cron whenever something is there. (Not just when something is created or updated, but if something exists.) So cron starts, looks in /var/cron/tabs and sees the .DS_Store file. It treats that file as a crontab but can't make sense of it and crashes. launchd does what it should and restarts cron.

The cycle repeats and eats your CPU.

[ Reply to This | # ]
10.4: One solution to a launchd-cron CPU usage issue
Authored by: Michael Levin on Nov 01, '05 01:23:05PM

Aha!! This might be what's happening to us. I'm a biologist with a fading memory of Unix administration from 10 years ago... I just set up a Tiger Xserve for our lab and everything was fine for a while and then the CPUs started maxing out at 100% due to cron activity! I suspect I may have the same problem as reported here. How in general can I avoid this in the future? I won't be using Finder to dig around in those folders, but if something does show up in that directory which causes cron to crash and be restarted, I'll have a problem again. How do people manage this issue? Is it really necessary for "cron to watch the /var/cron/tabs directory for new crontabs"? Can I turn that feature off, or is there a better/more elegant way to make sure this never happens? What should be in that directory, anyway? Currently, I see:

[mail:~] mlevin% ls -al /var/cron/tabs
total 48
drwxr-xr-x 8 root wheel 272 Nov 1 10:57 .
drwxr-xr-x 3 root wheel 102 Mar 20 2005 ..
-rw------- 1 root wheel 278 Oct 18 10:12 cyrusimap
-rw------- 1 root wheel 689 Nov 1 10:57 diradmin
-rw------- 1 root wheel 1490 Nov 1 10:57 mailman
-rw------- 1 root wheel 278 Nov 1 10:57 root
-rw------- 1 root wheel 268 Oct 10 03:14 test
-rw-r--r-- 1 root wheel 275 Nov 1 10:21 tmp.995

any help would be greatly appreciated. I need to know how to keep that directory clean! Thanks in advance.

Mike



[ Reply to This | # ]
muCommander
Authored by: dean_muc on Sep 15, '05 04:41:36PM
To avoid this kind of problems I highly recommend to use muCommander for browsing invisible folders. muCommander is a cross-platform file manager featuring a Norton Commander style interface.

[ Reply to This | # ]