This seems to be an issue with Apache2 and possibly resolv.conf from what I've read around so far.
We have a PHP-based web API running on Ubuntu 14.04 LTS which in turn sometimes talks to another web API. This has been happily running along for over a year now - until yesterday.
Yesterday (Wednesday) morning, we started getting exceptions with the second connection - PHP is producing the error:
getaddrinfo "No address associated with hostname"
This is PHP's way of saying it cannot resolv the hostname through DNS.
I logged into the server and ran an nslookup
for the domain being requested by the PHP script: it resolved.
I entered into PHP interactive mode and called dns_get_record()
for the domain being requested by the PHP script: it resolved.
After casting about on the internet a bit, all I could find was an obscure post saying that someone else had the problem because Apache was loading before resolv.conf so it was fixed by restarting/reloading Apache. I reloaded the Apache service and everything was working fine.
We've just had the same problem this morning... reloading fixed the problem again.
Now - the server has been up for 23 days now. The Apache service was restarted on Sunday morning, probably after some automatic updates. The problem first presented Wednesday morning and repeated Thursday morning (this morning).
Why is Apache suddenly forgetting how to resolve this web service domain name that it has been using for a year?
- Ubuntu 14.04.5 LTS
- PHP 5.5.9-1ubuntu4.21
- Apache/2.4.7
Sounds like you're experiencing USN-3239-2: GNU C Library Regression where an Ubuntu security update broke DNS lookups.
See also glibc update caused NSS ABI break on Launchpad.