1

All of a sudden our Ubuntu php5.6-fpm server has stopped working with curl requests.

Here is what i have found:

Works when ran from the console php test.php.

Works via wet from console wget -qO- https://maps.google.com/maps/api/geocode/json?address=Brooklyn+NY+USA&key=AIzaSyBGgTVnShML1_WHJL0rOTEnt2XOrgVgnu4 | cat

Works using curl from console ums-admin@svr1:/var/www/propertymonitor.ae/htdocs/v2$ curl https://maps.google.com/maps/api/geocode/json?address=Brooklyn+NY+USA&key=AIzaSyBGgTVnShML1_WHJL0rOTEnt2XOrgVgnu4

However calling the script via php-fpm on https://example.com/test.php it does not work and complains about DNS lookup failure?!

Restarting php5.6-fpm and it starts working again?!

Code below:

<?php
// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, "https://maps.google.com/maps/api/geocode/json?address=Brooklyn+NY+USA&key=AIzaSyBGgTVnShML1_WHJL0rOTEnt2XOrgVgnu4");

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// $output contains the output string
$data = curl_exec($ch);

if ($data === false)
{
echo 'Curl error: ' . curl_error($ch);
} else {
echo 'Response: ' . $data;
}

// close curl resource to free up system resources
curl_close($ch);
?>

And the rest of the system checks out:

cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
search example.com

And no packet loss:

64 bytes from 8.8.8.8: icmp_seq=3150 ttl=46 time=129 ms
64 bytes from 8.8.8.8: icmp_seq=3151 ttl=46 time=124 ms
64 bytes from 8.8.8.8: icmp_seq=3152 ttl=46 time=124 ms
64 bytes from 8.8.8.8: icmp_seq=3153 ttl=46 time=124 ms
^C
--- 8.8.8.8 ping statistics ---
3153 packets transmitted, 3153 received, 0% packet loss, time 3154312ms
rtt min/avg/max/mdev = 114.975/124.705/139.692/2.004 ms
5

See here: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1674733

An update caused this problem.

2

It seems the bug is fixed and released.

apt history log

  • Would the fix be installed with apt-get upgrade? – ptf Mar 22 '17 at 11:30
  • 1
    If you have automatic security updates it should be updated already. Otherwise apt-get update and apt-get upgrade should do the trick. – Yo-han Mar 22 '17 at 12:14
  • Thanks! I tried it, at it seems to work. Looks like the packages got downgraded. – ptf Mar 22 '17 at 16:09
  • Which versions are where it is fixed? Seeing the below: wheel@svr1:~$ apt-cache show libc6-dev | grep Version Version: 2.23-0ubuntu7 Version: 2.23-0ubuntu3 – g18c Mar 22 '17 at 16:34
  • Version 2.23-0ubuntu7 – Yo-han Mar 22 '17 at 17:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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