PasswordService failing on regular interval - "unable to send command to Password Server"
For anybody experiencing the issue where PasswordService will fail every few weeks, I've written a script that kickstarts it when it happens.
User logins will start failing (DIGEST-MD5) when this happens as will as caldav, cardav, jabber and others. Your opendirectoryd log will fill up with garbage that looks like this:
2012-06-11 08:04:51.021 EDT - 179.644232 - Client: c2s, UID: 84, EUID: 84, GID: 1, EGID: 1
2012-06-11 08:04:51.021 EDT - 179.644232, Node: /LDAPv3/127.0.0.1, Module: AppleODClient - unable to send command to Password Server - sendmsg() on socket fd 17 failed: Broken pipe (5205)
I was hopping for a fix from Apple, but I'd rather bandaid it at this point and be done with it. You can use this script in conjuction with the WatchPaths key in launchd. Set your WatchPaths to /private/var/log/opendirectoryd.log. Whenever the log gets updated, the script will run and check it for this error. If it sees it being logged, it kills PasswordService and opendirectoryd and exits.
#!/bin/bash if tail -n20 /private/var/log/opendirectoryd.log | grep -q "Broken pipe" then killall PasswordService; sleep 5; killall opendirectoryd; sleep 5; exit; fi