I have an EC2 instance where Laravel 5 app is hosted. The DB is Amazon Aurora RDS. The app has been running fine for months. But this morning the API was unreachable. Everything else works apart from any calls to the API that uses DB. Other calls are serving fine. The error was recorded as:

PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

But I could connect to the same DB from MySQL Workbench etc using the same exact details and nothing has changed in the app files in the meantime.

I restarted the Nginx and the problem is solved straight away and everything resumed to normal.

I still don't know what happened. Anyone could educate me on this as I am not sure if the problem can come back again randomly and how to stop that from happening.

share|improve this question

Same problem here on AWS EC2 with Ubuntu 14.04. Unattended upgraded last night :

2017-03-21 03:42:53,570 INFO Packages that will be upgraded: libc-bin libc-dev-bin libc6 libc6-dev libfreetype6 libfreetype6-dev locales multiarch-support

Just created a case on ubuntu bug tracker : https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1674733

Please click on "This bug affects me" to prioritize the fix on ubuntu side.

share|improve this answer
    
Thanks for that. Worrying as that bug affected some users badly. – James Mar 21 '17 at 15:47
    
This is the same issue I am experiencing. Thanks for this! – David Allen Mar 22 '17 at 13:29

They've issues a fix. See this link and the instructions at the bottom for your distro. https://www.ubuntu.com/usn/usn-3239-2/

share|improve this answer

I am experiencing the exact same issue. Ubuntu 16.04, PHP and Drupal - just started this morning. I have been reloading apache on an off all morning and that temporarily resolves it:

service apache2 reload

But that doesn't permanently fix it and it has come back a couple of times again.

share|improve this answer
    
Reboot the entire server? – Michael - sqlbot Mar 21 '17 at 18:39

As of March 20th, many Ubuntu users across the web were suddenly having DNS resolution issues pop up in their applications due to a bad update pushed out by Canonical (the maintainers of Ubuntu) which breaks DNS resolution after a few hours of uptime. Here's the bug report where the issue was reported and triaged:

https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1674532

This may have resulted in failures of your CMS to update/install plugins/install themes, failures to connect to external APIs, and/or error messages similar to the following:

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed:    No address associated with hostname

Could not resolve host: downloads.wordpress.org

cURL error 6: Could not resolve host: example.com in....

Fortunately Canonical has since been able to resolve the issue, but affected systems must update to acquire the fix. To do that, you'll need DNS working, so if it's currently down please first reboot your Droplet. Once DNS resolution is working as normal, please run:

sudo apt-get update
sudo apt-get upgrade

Then you can check your versions to ensure you've got the right ones. This can be done with:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'

If you're on Ubuntu 16.X, you should see output similar to the following:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7

If you're on Ubuntu 14.X, you should see output similar to the following:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.19-0ubuntu6.11
2.19-0ubuntu6.11

If you see older versions of those packages, you'll need to upgrade per the previous instructions to avoid this issue.

share|improve this answer

We just experienced the same today. We are running Drupal 7 on a Ubuntu 16.04 box with PHP 7.0, nginx in EC2 connecting to an RDS instance.

We do have unattended upgrades enabled and the following was upgraded this morning:

Start-Date: 2017-03-21 06:13:56 Commandline: /usr/bin/unattended-upgrade Upgrade: libc6:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), locales:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), libc-bin:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), multiarch-support:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), libfreetype6:amd64 (2.6.1-0.1ubuntu2, 2.6.1-0.1ubuntu2.1) End-Date: 2017-03-21 06:14:00

The solution was to restart nginx and PHP:

sudo service nginx restart
sudo service php7.0-fpm restart
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.