Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking mDNSResponder / Error in set_waitlimit #1

Open
GupTk opened this issue Nov 15, 2019 · 0 comments
Open

Blocking mDNSResponder / Error in set_waitlimit #1

GupTk opened this issue Nov 15, 2019 · 0 comments

Comments

@GupTk
Copy link

GupTk commented Nov 15, 2019

Hi,
I have seen situations where my mDNSResponder (765.50.9) seems to be busy (blocking one core) and not responding to a
DNSServiceGetProperty(kDNSServiceProperty_DaemonVersion, &uiDaemonVersion, &size);
call.
The high CPU and the blocking of the daemon stopped when I attached the debugger - so this is still a mystery.

But for the first step I wondered why the call is blocked on the client side.
While examining the blocking a stumbled across the following function

static int set_waitlimit(dnssd_sock_t sock, int timeout)
{
    int gDaemonErr = kDNSServiceErr_NoError;

    // To prevent stack corruption since select does not work with timeout if fds > FD_SETSIZE(1024)
    if (!gDaemonErr && sock < FD_SETSIZE)
    {
        struct timeval tv;
        fd_set set;

        FD_ZERO(&set);
        FD_SET(sock, &set);
        tv.tv_sec = timeout;
        tv.tv_usec = 0;

IMHO the conditon
sock < FD_SETSIZE
is wrong, as my sockets are larger that FD_SETSIZE (==64) and this limit only describes the number of socket in the fd_set, not the socket handle itself.

Any opinion to this?
Thanks
Tobias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant