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] |
Recently, a bunch of service requests in the middle of Google's mighty stack started failing, and it was tracked down to a situation where a program would run out of file descriptors, then getaddrinfo() would fail, but even after the file descriptors were closed and freed up, getaddrinfo() would continue to return an error. It turns out that subroutines of getaddrinfo() set h_errno to negative values, and higher-level code such as gaih_inet tests it, but there is nobody to reset it, so a negative value persists and then causes later getaddrinfo calls to report an error even though everything works fine. Technically, there is probably a mistake in the bowels of resolver code where the caller should recognize that the call has not failed, and so h_error should not be looked at. However, as I understand the documentation, getaddrinfo should not be touching h_errno anyway, unless there is an error return. So I'm proposing a patch that simply saves h_errno, clears it internally, and then restores it if getaddrinfo succeeds. 2016-07-12 Stan Shebs <stanshebs@google.com> * sysdeps/posix/getaddrinfo.c (getaddrinfo): Save/restore h_errno. * posix/tst-getaddrinfo6.c: New test. * posix/Makefile (tests): Add tst-getaddrinfo6.
Attachment:
gai-patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |