My battery has been getting drained lately, when I look, something called mdnsd is draining a good chunk of power, about 10% of the power draw second only to the screen in power draw. I've looked online but people say it's firefox, which I don't use. I just use the basic internet browser. Does anyone know what other apps cause this?
1 Answer
Following the discussion here, mentioning mdnsd as a bug associated with firefox, it now tends its not firefox alone being attributed to this massive power drain through mdnsd.
A more detailed explanation of this "mdnsd bug" has been offered:
mdnsd is actually an Android daemon process that provides DNS services, as well as local device discovery service for the local network (multicast zero-config networking) and the purpose is to translate a qualified name into an appropriate IP address for the service or device.
It is believed that this multicast zero-config networking works by responding with a mapping dump when it sees a query for a local local service or a known local device, thus it can generate a lot of network traffic.
Now the suspicion is, in a situation where there are too many responses from other services/devices, a local mdnsd gets overloaded with too much traffic coming in all at once, such that the system starts dropping response packets and consenquently runs out of buffers.
When other applications are running e.g Facebook, Ping&DNS etc, it contributes to packet loss and utilisation of packet buffers, worsening the situation. At such a time when the local system eventually runs out of buffers, it goes into a loop trying to write responses. At this point, the loop causes the full utilisation of one of the CPUs and draining the battery.
In an another attempt to troubleshoot the issue, one user did some packet sniffing on the Wi-Fi network, and noticed different mdnsd packets coming from the phone, ironically found a certain packet that was sent in bursts every few seconds and seemed to correlate with this bug.
Some important findings:
- After reboot, these packets do not occur.
- As soon as OP launched facebook (and no other app does this), the mdnsd messages started, and continued even after shutting down facebook until reboot.
- Unstalling facebook, appeared to have solved the problem
- Reinstalling facebook brought back the issue.
Conclusion
The main issue to note has to do with multicast dns services not appropriately able to handle requests, and an overload triggering the loop which subsequently affect the CPU viz battery. One author also mentions the bug titled "Fix mDNS socket leak during network configuration changes" (2014) but from the look of thing it didn't (or hasn't) addressed all android versions.
Some workarounds
- In the case that you have Facebook, try sacrificing Facebook mobile, for Desktop version (i.e unistalling Facebook from your android device)
Edit
Also as suggested by @DocSalvager:
In any browser, go to m.facebook.com to use the mobile version. To regain the ability to share to Facebook after uninstalling the app, install something like Tinfoil for Facebook or Swipe
Root device and run a script that restarts the mdnsd service every 30 mins (
#setprop ctl.restart mdnsd
) Thanks to timinaust.- Regulary restarting device.
References
-
1In any browser, go to m.facebook.com to use the mobile version. To regain the ability to share to Facebook after uninstalling the app, install something like Tinfoil fir Facebook or Swipe. Commented Aug 16, 2017 at 20:11