This is the mail archive of the libc-alpha@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]

Re: [PATCH][BZ #14719] Return EAI_SYSTEM from getaddrinfo if we run out of fds


On Mon, Apr 01, 2013 at 11:09:28AM +0530, Siddhesh Poyarekar wrote:
> On 25 March 2013 18:28, Dmitry V. Levin <ldv@altlinux.org> wrote:
> > As a side effect of this change, ECONNREFUSED results to EAI_SYSTEM
> > instead of EAI_AGAIN.  Caught by gnulib's test-getaddrinfo which now fails
> > when no network is available:
> > http://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-getaddrinfo.c
> > Other apps may rely on getaddrinfo returning EAI_AGAIN in case of
> > ECONNREFUSED, so this is a regression.
> 
> I am not able to reproduce this either with networking disabled (i.e.
> no nameservers defined, interfaces down, etc.) or with an invalid
> nameserver (an active host that does not have anything listening on 53
> udp or tcp).  In both cases I get EAI_NONAME with 2.15 as well as
> 2.17.  Can you provide steps to reproduce?

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
$ ip r
$ cat /etc/resolv.conf 
nameserver 192.0.43.10
$ cat t.c
#include <stdio.h>
#include <netdb.h>
int main(void) {
	struct addrinfo *ai;
	int res = getaddrinfo ("example.net", "http", 0, &ai);
	if (res)
		printf("%s: %m\n", gai_strerror(res));
	return res && res != EAI_NONAME;
}
$ gcc -Wall -O2 t.c -o t && ./t
System error: Connection refused
$ strace -econnect ./t
--- stopped by SIGSTOP ---
--- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=4567, si_uid=567} ---
connect(3, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.0.43.10")}, 16) = -1 ENETUNREACH (Network is unreachable)
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.0.43.10")}, 16) = -1 ENETUNREACH (Network is unreachable)
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.0.43.10")}, 16) = -1 ENETUNREACH (Network is unreachable)
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.0.43.10")}, 16) = -1 ENETUNREACH (Network is unreachable)
System error: Connection refused
+++ exited with 1 +++


-- 
ldv

Attachment: pgp7mPrs93KCD.pgp
Description: PGP signature


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