MacOS – causing launchd to burn the CPU

launchdmacos

I'm running Yosemite, a clean install.

launchd continuously runs at 100% CPU. Since the Yosemite upgrade I can't change the log level with 'sudo launchctl log level debug'

Checking top or Activity Monitor I can see that launchd itself is using the CPU heavily, not a process which it's spawning off. It has the highest cpu time on the box, 3 times that of kernel task, and vastly higher than Plex which is genuinely CPU heavy – video transcoding, and it supports a lot of clients in the house running frequently.

Nothing significant in the logs that I can see: the most frequent message:

11/6/14 10:06:38.748 PM com.apple.xpc.launchd[1]:
(com.apple.imfoundation.IMRemoteURLConnectionAgent) The
_DirtyJetsamMemoryLimit key is not available on this platform.

That's only about 3-6 times per hour.

I did a quick check through all the launchd daemons to find any error codes.

alex@smiley:~|⇒  launchctl list | grep -v "\t0\t"
PID Status  Label
28122   -15 com.apple.Finder
alex@smiley:~|⇒  sudo launchctl list | grep -v "\t0\t"
PID Status  Label
219 -43 com.apple.watchdogd
21134   -15 com.apple.security.syspolicy

Interestingly the -43 code on Watchdogd doesn't match the output of launchctl list:

alex@smiley:~|⇒  sudo launchctl list com.apple.watchdogd
{
    "StandardOutPath" = "/var/log/watchdogd/log";
    "LimitLoadToSessionType" = "System";
    "StandardErrorPath" = "/var/log/watchdogd/log";
    "Label" = "com.apple.watchdogd";
    "TimeOut" = 30;
    "OnDemand" = false;
    "LastExitStatus" = 171;
    "PID" = 219;
    "Program" = "/usr/libexec/watchdogd";
    "ProgramArguments" = (
        "/usr/libexec/watchdogd";
    );
};

In any case, I'm not sure if they're symptomatic, or just a red-herring.

How can I find out what's making launchd DOS my computer?

Best Answer

There is an app called LaunchControl which provides a very nice interface for creating/checking/modifying/disabling launch daemons and agents. It's much easier than looking in 5 different folders for startup items. (I'm not affiliated with them in any way.)

I would go through and disable each one at a time until your problem disappears.

http://www.soma-zone.com/LaunchControl/