Bug 9954 - getaddrinfo assertion triggered without reason
: getaddrinfo assertion triggered without reason
Status: NEW
Product: glibc
Classification: Unclassified
Component: network
: unspecified
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-03-15 15:31 UTC by Aurelien Jarno
Modified: 2012-12-19 10:43 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Last reconfirmed: 2010-06-01 03:44:20


Attachments
Patch to fix the problem. (1.50 KB, patch)
2009-03-15 15:32 UTC, Aurelien Jarno
Details | Diff
testcase (449 bytes, text/x-csrc)
2009-03-15 20:49 UTC, Aurelien Jarno
Details
/etc/host.conf for testcase (9 bytes, text/plain)
2009-03-15 20:50 UTC, Aurelien Jarno
Details
/etc/hosts for testcase (99 bytes, text/plain)
2009-03-15 20:51 UTC, Aurelien Jarno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aurelien Jarno 2009-03-15 15:31:06 UTC
With the following /etc/hosts:
127.0.0.1       www.my-domain.es
127.0.1.1       www.my-domain.es
192.168.0.1     www.my-domain.es

Using getaddrinfo() on www.my-domain.es, trigger the following assertion:
../sysdeps/posix/getaddrinfo.c:1473: rfc3484_sort: Assertion 
`src->results[i].native == -1 || src->results[i].native == a1_native' failed.

This is due to two different bugs:
- In rfc3484_sort() rule 7, src->results[i].native is assigned even if 
src->results[i].index is -1, meaning that no interface is associated.
- In getaddrinfo() the source IP address used with the lo interface needs a 
special case, as it can be any IP within 127.X.Y.Z.

Patch fixing both problems will follow shortly.
Comment 1 Aurelien Jarno 2009-03-15 15:32:10 UTC
Created attachment 3822 [details]
Patch to fix the problem.
Comment 2 Ulrich Drepper 2009-03-15 18:39:42 UTC
None of the change should be needed.

None of the known interfaces should have the index -1 and hence the test should
be unnecessary.  If this is not the case there is a problem elsewhere and you're
hiding it with the change.

For the deprecated addresses the same, the problem is in the configuration and
you're hiding it.

And no, I cannot reproduce any problem with the information you provide.  You
have to be much more detailed.
Comment 3 Aurelien Jarno 2009-03-15 20:19:21 UTC
> None of the known interfaces should have the index -1 and hence the test
> should be unnecessary.  If this is not the case there is a problem elsewhere
> and you're hiding it with the change.

Entries in /etc/hosts corresponding to IP 127.X.Y.Z, while being different than 
127.0.0.1 are getting index -1, thus triggerring the problem.
Comment 4 Aurelien Jarno 2009-03-15 20:49:59 UTC
Created attachment 3823 [details]
testcase
Comment 5 Aurelien Jarno 2009-03-15 20:50:51 UTC
Created attachment 3824 [details]
/etc/host.conf for testcase
Comment 6 Aurelien Jarno 2009-03-15 20:51:56 UTC
Created attachment 3825 [details]
/etc/hosts for testcase
Comment 7 list 2009-07-17 18:13:58 UTC
I'm also hitting this and it seems to be due to conflicts between /etc/hosts and
DNS. I've removed everything but localhost from /etc/hosts, and now everything
seems fine. However, this "assertion failed" message is very unclear. It's very
hard to find out what's actually causing it because there's not even the
slightest hint of what we are actually talking about. What is src, what's the
meaning of the results field, what is a1_native...?
Providing just a *little* bit of context would greatly ease the debugging of
this. Right now, the only option of getting *some rough* idea of what this
assertion actually means is reading the code, which is obiously very
time-consuming for anyone not familiar glibc internals.