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/14001] New: getaddrinfo sometimes slow in multithreaded programs


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

             Bug #: 14001
           Summary: getaddrinfo sometimes slow in multithreaded programs
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
        AssignedTo: unassigned@sourceware.org
        ReportedBy: wfpeltz@yahoo.de
    Classification: Unclassified


Created attachment 6352
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6352
test program

If two or more threads invoke getaddrinfo for the same node at (about) the same
time, the program hangs for 5 seconds (Fedora 17 x64_64, glibc 2.15) or for an
integral multiple of 5 seconds (Fedora 16 x64_64, glibc 2.14) before delivering
the correct result.

I have attached a short test program. You can try something like this:

time ./getaddrinfo_test www.amazon.com
(Amazon is one of the "slowest" hosts under Fedora 16. It often hangs for 20 or
25 seconds.)

If you specify a second argument, the second thread invokes getaddrinfo with
that second argument as "node". If the two nodes differ, the program never
hangs.

The program also doesn't hang if the node is "localhost". Under Fedora 17, it
doesn't hang if it is executed for a second time with the same node shortly
after the first execution. But under Fedora 16 it hangs even in this case.

One program that is affected by this bug is Privoxy. It starts a new thread for
each request, and if someone opens a web page the browser sends many requests
to the proxy for all the elements on the web page which in most cases go to the
same server. It doesn't cache the result of getaddrinfo. (Should it? I don't
think so.)

-- 
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]