ports/183512: mdnsd from net/mDNSResponder wakes up every 976us
Bradley T. Hughes
bradleythughes at fastmail.fm
Thu Oct 31 06:00:04 UTC 2013
>Number: 183512
>Category: ports
>Synopsis: mdnsd from net/mDNSResponder wakes up every 976us
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Oct 31 06:00:03 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Bradley T. Hughes
>Release: 10.0-BETA2
>Organization:
>Environment:
FreeBSD freebsd10.local 10.0-BETA2 FreeBSD 10.0-BETA2 #0 r257166: Sat Oct 26 19:23:22 UTC 2013 root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
The mdnsd daemon from net/mDNSResponder, once started, works correctly, but never idles. This can be seen as constant load on the machine, with constant wake ups. After examining and tracing the code, in particular mDNSPosix/mDNSPosix.c and mDNSPosix/PosixDaemon.c, I noticed that most of the load comes from very load timeout values passed to select(), but once select() returned and mDNS_Execute(), from mDNSCore/mDNS.c, never actually did any work. Using the ShowTaskSchedulingError() method from mDNSCore/DNSCommon.c, I noticed that the m->clearIgnoreNA flag was never cleared. After finding the relevant code in mDNS_Execute(), I noticed that the flag is cleared inside an #ifdef APPLE_OSX_mDNSResponder/#endif block. A small oversight, I think. I've attached a patch that moves the #ifdef to just around the OSX specific function, allowing the clearIgnoreNA flag to be properly set, and mdnsd now idles when there is nothing more to do.
>How-To-Repeat:
1. Install net/mDNSResponder
2. # echo 'mdnsd_enable="YES"' >> /etc/rc.conf
3. # service mdnsd start
4. Observe system activity, CPU and load rises,
>Fix:
See the attached patch. FYI, I have not reported this upstream. I am unsure if my patch is the correct fix or not. An alternative would be to only set the clearIgnoreNA flag inside a similar #ifdef APPLE_OSX_mDNSResponder block.
Patch attached with submission follows:
--- mDNSCore/mDNS.c.orig 2013-10-31 06:41:04.868158806 +0100
+++ mDNSCore/mDNS.c 2013-10-31 06:41:21.089955155 +0100
@@ -4508,13 +4508,13 @@
// After two seconds after the owner option is set, call the ioctl to clear the
// ignore neighbor advertisement flag.
-#if APPLE_OSX_mDNSResponder
if (m->clearIgnoreNA && m->timenow - m->clearIgnoreNA >= 0)
{
+#if APPLE_OSX_mDNSResponder
mDNSPlatformToggleInterfaceAdvt(m, mDNSfalse);
+#endif
m->clearIgnoreNA = 0;
}
-#endif
// Clear AnnounceOwner if necessary. (Do this *before* SendQueries() and SendResponses().)
if (m->AnnounceOwner && m->timenow - m->AnnounceOwner >= 0)
{
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list