discoveryd or: How I Learned to Stop Worrying and Love the BombNo ratings yet.
I originally wrote this back in March and it didn't get published, but given the new surge of
discoveryd complaints, I'm posting it here now.
Apple is getting a lot of flack about quality after the release of iOS 8 and OS X Yosemite. As a crazy person who spends most of her time tracking down spurious iOS and OS X behavior, I've observed that most of the issues stem from one place: device discovery. I want to take a moment and plainly discuss what's going on, in the hope that explanation will help non-developers experiencing these issues.
For iOS 8 and OSX Yosemite (OSX 10.10), much of the wireless device discovery services were rewritten, presumably to "clean them up" and add support needed for things like AirDrop and Continuity (the thing that lets you do cool stuff like take a call on your Mac when your iPhone rings.) The rewritten parts handle all of the detection of devices on your wi-fi network like iOS devices, wireless printers, and other Macs as well as facilitating things like iTunes Music sharing.
With a set of system services like this, there are bound to be many unexpected scenarios that only appear "in the wild" when real customers use the software. I would be a bad computer scientist if I also didn't mention Joel on Software's reminder that you are throwing away all of your real-world experience when you rewrite software. However, Apple is taking big strides in how connected devices work together, so big changes and rewrites are to be expected.
Iljitsch van Beijnum at Ars Technica describes a set of problems caused by the rewrite. Here are a few more to demonstrate how issues and scale in connectivity services can wreak havoc everywhere:
Some iOS devices (especially 5s and below) running iOS 8 experience wi-fi disconnects. When I see this in my own testing, the disconnect is silent, the iPhone still shows a wireless indicator like it is working, and just uses my cell service instead. Here is a technical discussion and jail-break solution for this issue, in case you're interested.
Yosemite takes a noticeably-long time to boot up, sometimes fails to find webpages, and Bonjour in the Messages app is intermittent at best.
This rewrite is causing goofy things like iOS devices to fail to be recognized by iTunes, a problem fixed by restarting discoveryd or the computer. This issue leaked back into Mavericks running iTunes 12 also. I'm not sure if iOS 8 and Yosemite devices are clogging device discovery for Mavericks machines (using mDNS not discoveryd) on the wireless network, or if some of the framework changes were applied to Mavericks for security patches.
As a developer, I can only imagine how I'd feel if I contributed to this rewrite. It's interesting to me that device discovery is so pervasive that it can make mayhem across so much of the Apple landscape, leading to a massive outcry about the quality of Apple's recent releases. The rewrite is probably 90% awesome, and a lot of things we don't notice probably work better and more securely. Not to mention the rewrite likely supports many of the cool device-interaction features we got in iOS 8 and Yosemite. However, if I was working on this project, the 10% pain would be causing me a lot of sleepless nights and guilt. (If an engineer who works on discoveryd/mDNS reads this, here is an e-hug.)
You may be saying "So what can I do about this?"
You can wait, since Apple has said that they are focusing on fixes and tightening up for the next major iOS and OSX version releases. This is not a great option, I know.
You can turn off "optional" wi-fi sharing features that you aren't using to reduce the frequency of Bonjour traffic on your wifi network. If you don't use AirDrop, turn it to off (note: this doesn't turn it completely off, as the jail-break solution I linked above discusses.)
If any kind of wi-fi sharing thing isn't working right, don't be shy about rebooting the offending participants. That will restart the discoveryd service on the two participants which should clear up a sporadic issue here and there.
You can shut down mostly everything on the network and bring everything back up again. Yes, that is a terrible option, but it's helpful to have options.
In the Ars Technica article I linked above, there are instructions for replacing discoveryd with Maverick's mDNS service. I don't recommend this, since you may be losing out on security and functionality updates coming in the near future (and who knows what will break in the future). You don't know me, but hopefully you'll trust the same advice from John Gruber.