public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12926] New: getaddrinfo()/make_request() may spin forever
@ 2011-06-23 16:51 ppluzhnikov at google dot com
  2011-07-16  5:36 ` [Bug libc/12926] " nick.jones@network-box.com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: ppluzhnikov at google dot com @ 2011-06-23 16:51 UTC (permalink / raw)
  To: glibc-bugs

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

           Summary: getaddrinfo()/make_request() may spin forever
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: ppluzhnikov@google.com


I am not sure whether this is a kernel bug or a glibc bug.

Even if it is a kernel bug, it might be wise to fix it in glibc, since
buggy kernels are observed "in the wild".

Over last two weeks, we observed several Java programs that have a thread
spinning here:

#0  0xf7717430 in __kernel_vsyscall ()
#1  0xf757e448 in recvmsg () at ../sysdeps/unix/sysv/linux/i386/socket.S:97
#2  0xf76797a6 in make_request (fd=1590, pid=<value optimized out>,
seen_ipv4=0x7dceea7b, seen_ipv6=0x7dceea7a, in6ai=0x7dceea70,
in6ailen=0x7dceea6c) at ../sysdeps/unix/sysv/linux/check_pf.c:123
#3  0xf7679bd4 in __check_pf (seen_ipv4=0x7dceea7b, seen_ipv6=0x7dceea7a,
in6ai=0x7dceea70, in6ailen=0x7dceea6c) at
../sysdeps/unix/sysv/linux/check_pf.c:275
#4  0xf761ff4c in getaddrinfo (name=0x988f330 "<a-valid-host-name>",
service=0x0, hints=0x7dceeaf8, pai=0x7dceeb18) at
../sysdeps/posix/getaddrinfo.c:2109
...

strace shows un-ending stream of recvmsg() calls, which all return 0.

Looking in check_pf.c, it seems clear that if recvmsg() keeps returning 0,
then the for() loop on line 131 (current git source) will not execute,
and the do-while loop on line 113 will spin forever.

We do not know what conditions provoke the kernel (2.6.34-smp and 2.6.26-smp
have been observed) to return zero here, and the problem is not repeatable
on the same machine.


The following patch will make make_request() fail under these conditions.
Not sure whether that's the right thing to do.

diff --git a/sysdeps/unix/sysv/linux/check_pf.c
b/sysdeps/unix/sysv/linux/check_pf.c
index c053adc..47cf034 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -121,7 +121,7 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool
*seen_ipv6,
        };

       ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
-      if (read_len < 0)
+      if (read_len <= 0)
        goto out_fail;

       if (msg.msg_flags & MSG_TRUNC)

-- 
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] 16+ messages in thread

end of thread, other threads:[~2015-10-23 20:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 16:51 [Bug libc/12926] New: getaddrinfo()/make_request() may spin forever ppluzhnikov at google dot com
2011-07-16  5:36 ` [Bug libc/12926] " nick.jones@network-box.com
2011-07-16  5:43 ` ppluzhnikov at google dot com
2011-07-17  3:32 ` bugdal at aerifal dot cx
2014-06-27 13:04 ` fweimer at redhat dot com
2014-10-14 16:05 ` cvs-commit at gcc dot gnu.org
2014-10-14 16:06 ` siddhesh at redhat dot com
2015-05-27  9:54 ` fengtiantian at huawei dot com
2015-05-27 11:29 ` jim.king at simplivity dot com
2015-08-22 20:32 ` [Bug network/12926] " jsm28 at gcc dot gnu.org
2015-10-16 20:36 ` fweimer at redhat dot com
2015-10-21 14:17 ` jim.king at simplivity dot com
2015-10-21 14:21 ` fweimer at redhat dot com
2015-10-21 15:28 ` carlos at redhat dot com
2015-10-21 16:01 ` joseph at codesourcery dot com
2015-10-23 20:08 ` fweimer at redhat dot com

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).