Bug #11058 [Com]: php_network_getaddresses: getaddrinfo failed
| From: | kostello at gmail dot com | Date: | Fri, 24 Mar 2017 03:45:33 +0000 |
| Subject: | Bug #11058 [Com]: php_network_getaddresses: getaddrinfo failed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208039@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=11058&edit=1
ID: 11058
Comment by: kostello at gmail dot com
Reported by: pat at mail dot rit dot edu
Summary: php_network_getaddresses: getaddrinfo failed
Status: Not a bug
Type: Bug
Package: Network related
Operating System: OpenBSD 2.6
PHP Version: 4.0.6
Block user comment: N
Private report: N
New Comment:
To heiglandreas: I have tried to update my system (Ubuntu 14.04 LTS) and there is no mention of such
an update, unfortunately. What's more, the two VMs that encountered the error were not updated
for several days prior to the problem. And finally, the name resolution error occurred only within
PHP - other attempts to replicate the problem outside of PHP failed. I am not saying you are wrong,
on the contrary you are in a much better place than myself to know what's happening, I am just
providing additional elements for you to consider. It shall be noted that I haven't encountered
the error again since the last time I restarted PHP-FPM on either VM.
To spam2 at rhsoft dot net: I do not believe this applies to my case. The uptime on the first VM was
several days, with few daily HTTP requests (about 1000-2000) and very few of these required name
resolution - the file_get_contents($url) instruction is used in only specific part of my
application. The second VM had about 12 hours uptime when the error occurred and had received less
than 50 HTTP requests. I shall add that the two VMs are on two completely separate network, in
different countries, and once again outside of PHP everything was working perfectly fine. Also, no,
I did not update server components before the errors occurred. I did not do anything in particular.
I wish my bash_history file had time stamps to show you I am talking in good faith.
Previous Comments:
------------------------------------------------------------------------
[2017-03-23 17:37:41] heiglandreas@php.net
This is an issue on the Ubuntu-side! They rolled out a faulty update. https://launchpad.net/ubuntu/+source/glibc/2.23-0ubuntu7
This is NOT a PHP-Issue!
------------------------------------------------------------------------
[2017-03-23 17:08:43] spam2 at rhsoft dot net
And i still bet it is not a problem on the php side - disable response rate limiting on your
nameserver, switch to. A different or setup your own resolver
I had a similar issue because I thought php at least would cache the answers at least within a loop
doing file_get_contents() over a large url-array all within the same domain
So when your page has such code and some bot is running wild you produce the dns request for each
and every pagecall and so easily exceed response limits
When you use the curl extension identical dns queries are at least cached within the same request
------------------------------------------------------------------------
[2017-03-23 16:33:16] chilieu dot me at gmail dot com
This happened to our server again in 24hrs
Our is running Ubuntu 16.04 LTS, nginx, PHP-FPM, PHP 7.0.15-1+deb.sury.org~trusty+1
when I was trying to use file_get_contents to get estimation shipping fee from ups
the only way I can fix it is restart php
------------------------------------------------------------------------
[2017-03-23 08:56:21] spam2 at rhsoft dot net
did you guys who are affected install updates on your machines which replaced from webserver/php
loaded libraries without re-starting the webserver? updating "nss" without hard restart
httpd was the only time in the past decade where is saw similar issues - hence don't appyl
autoupdates blindly and restart services with orphaned filehandles - especially services which are
forking or have multiple threads
------------------------------------------------------------------------
[2017-03-23 08:48:36] kostello at gmail dot com
I have just encountered this issue twice on two separate virtual machines over the past 24 hours!
These VMs are stable, the uptime was about one week for the first, about twelve hours for the
second, when the errors occurred. They both run Ubuntu 14.04 LTS, nginx 1.8, PHP-FPM. More
specifically, the first VM runs PHP 7.0.15-1+deb.sury.org~trusty+1, and the second one runs PHP
5.5.9-1ubuntu4.21. Here is the error message I get with file_get_contents($url)
>> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address
>> associated with hostname in /script.php on line 276
>> Warning: file_get_contents(http://www.******.com/history.php): failed to open stream:
>> php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /script.php on
>> line 276)
NB: using CURL did not work either but did not return any data nor did it trigger any error message.
However I assume that it is for the same reason.
Both times, I inspected the configuration: DNS resolvers, permissions on /etc/hosts, on
/etc/resolv.conf, and other things, all good. Furthermore, no DNS issues to report when using
"wget" or "svn update" or any other network tool - it was really just PHP. To
rule out a possible error in my own PHP scripts, I created a simple "test.php" file with
one line: file_get_contents('http://www.google.com') and the error still occurred.
The only way I could got rid of the problem in both cases was doing a "service php-fpm
restart". As the issue was critical, I had to quickly proceed with the restart and I
didn't have time to investigate further. How can I make sure this doesn't happen again?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=11058
--
Edit this bug report at https://bugs.php.net/bug.php?id=11058&edit=1