This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/14719] New: getaddrinfo() returns EAI_NONAME when out of file descriptors


http://sourceware.org/bugzilla/show_bug.cgi?id=14719

             Bug #: 14719
           Summary: getaddrinfo() returns EAI_NONAME when out of file
                    descriptors
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
        AssignedTo: unassigned@sourceware.org
        ReportedBy: robryk+bugzilla@gmail.com
    Classification: Unclassified


When getaddrinfo(host, NULL) is called with the fd limit exhausted, it returns
EAI_NONAME. I would expect it to return EAI_SYSTEM or EAI_AGAIN.

I've checked version 2.16 and repository HEAD; they both behave that way. The
following program demonstrates the issue (when the fd limit is set):

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#include <fcntl.h>

int main()
{
    int fd;
    do {
        fd = open("/dev/null", O_RDONLY);
    } while (fd != -1);
    struct addrinfo* res;
    int err = getaddrinfo("google.com", NULL, NULL, &res);
    printf("%s\n", gai_strerror(err));
    return 0;
}

This also happens if I do a successful lookup beforehand (in which case, if I
understand correctly, configuration from nsswitch.conf and proper libnss_*
libraries are already loaded).

I suspect that at least part of this issue stems from behavior of
_nss_dns_gethostbyname4_r, which returns NSS_STATUS_NOTFOUND, even though
h_errno is set to TRY_AGAIN in __libc_res_nsearch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]