Sources Bugzilla – Bug 9954
getaddrinfo assertion triggered without reason
Last modified: 2012-12-19 10:43:34 UTC
With the following /etc/hosts:
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.
Created attachment 3822 [details]
Patch to fix the problem.
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.
> 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.
Created attachment 3823 [details]
Created attachment 3824 [details]
/etc/host.conf for testcase
Created attachment 3825 [details]
/etc/hosts for testcase
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.