public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug network/14719] New: getaddrinfo() returns EAI_NONAME when out of file descriptors
@ 2012-10-14 15:56 robryk+bugzilla at gmail dot com
  2012-10-14 15:57 ` [Bug network/14719] " robryk+bugzilla at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: robryk+bugzilla at gmail dot com @ 2012-10-14 15:56 UTC (permalink / raw)
  To: glibc-bugs


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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-02-23 15:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-14 15:56 [Bug network/14719] New: getaddrinfo() returns EAI_NONAME when out of file descriptors robryk+bugzilla at gmail dot com
2012-10-14 15:57 ` [Bug network/14719] " robryk+bugzilla at gmail dot com
2012-10-23 10:39 ` siddhesh at redhat dot com
2012-11-19  8:34 ` siddhesh at redhat dot com
2012-11-19 10:12 ` robryk at gmail dot com
2013-03-25 13:15 ` siddhesh at redhat dot com
2013-04-04  9:30 ` siddhesh at redhat dot com
2014-02-16 19:43 ` jackie.rosen at hushmail dot com
2014-05-28 19:45 ` schwab at sourceware dot org
2014-06-14 12:51 ` fweimer at redhat dot com
2015-01-29 18:50 ` cvs-commit at gcc dot gnu.org
2015-02-23 15:02 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).