Five Pounds of Flax

Every culture has a burrito.

Is your lookupd crashing? It's years-old bug #3632865

Monday, November 27, 2006posted by Michael Rothwell @ 7:28 AM

If your Mac beachballs when, for example, you're trying to unlock the screensaver, and comes back after a few minutes, "lookupd" could be the culprit. Look in your console log (/Applications/Utilities/Console) for lines like the following.

lookupd[283]: NetInfo connection failed for server 127.0.0.1/local
lookupd[283]: ni_statistics: Communication failure
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
lookupd[283]: NetInfo connection failed for server 127.0.0.1/local
lookupd[283]: ni_statistics: Communication failure
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local
lookupd[283]: NetInfo connection failed for server 127.0.0.1/local
DirectoryService[82]: NetInfo connection failed for server 127.0.0.1/local

This is not a new problem. In fact, it's been around for years. John Bafford released unlockupd, in 2004, to work around the bug in lookupd that causes this problem. Here is his explanation of the issue:

Lookupd is the lookup and caching daemon responsible for handling NetInfo, DNS, and other such requests. Applications typically do not access lookupd directly, but rather, use standardized library functions (such as gethostbyname for DNS) which access lookupd on the application's behalf.

Lookupd has a bug (rdar://3632865) in its cache cleanup code that causes it to randomly crash. CrashReporter, the system crash log agent, does not properly handle lookupd crashes, and as a result, when lookupd crashes, the process is not terminated. Since lookupd has not terminated, mach_init does not respawn lookupd. From this point, any application that attempts to access lookupd, either directly or indirectly, will hang.

Once lookupd stops responding, it becomes difficult, but not impossible, to recover the system to a usable state. One technique which works, but is not recommended (for obvious reasons), is to leave a root shell running and `killall -9 lookupd` when it becomes obvious that lookupd has died (sudo does not work, since it requires lookupd's services, as does opening a new terminal window).

The bug number is apparently 3632865 in Apple's bug-tracking system, "radar". The rdar url above is usable by Apple folks, only. There's no way for the public to see the details of that bug number. Joel wrote a little article about this problem as well.