Temporary failure in name resolution - fsockopen()

Temporary failure in name resolution - fsockopen()

am 25.03.2010 11:21:54 von David Lidstone

We recently para-virtualised a Xen / CentOS box which is running script
which uses fsockopen() to get a connection to an SMTP server.

Since the server changes it fails approx 50% of the time with:

"php_network_getaddresses: getaddrinfo failed: Temporary failure in name
resolution"

We've tried the solutions from Googling this error (such as restarting
Apache etc), but without success.

Why am I wasting your time with a Linux upgrade issue? Well,
gethostbyname() seems to resolve the IP every time. Manual lookups on
from the server seem to work with no problems.

Any help greatly appreciated. Should I perhaps be pointing this out on
the 'internals' list?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Temporary failure in name resolution - fsockopen()

am 25.03.2010 12:29:39 von Nilesh Govindrajan

On 03/25/2010 03:51 PM, David Lidstone wrote:
> We recently para-virtualised a Xen / CentOS box which is running script
> which uses fsockopen() to get a connection to an SMTP server.
>
> Since the server changes it fails approx 50% of the time with:
>
> "php_network_getaddresses: getaddrinfo failed: Temporary failure in name
> resolution"
>
> We've tried the solutions from Googling this error (such as restarting
> Apache etc), but without success.
>
> Why am I wasting your time with a Linux upgrade issue? Well,
> gethostbyname() seems to resolve the IP every time. Manual lookups on
> from the server seem to work with no problems.
>
> Any help greatly appreciated. Should I perhaps be pointing this out on
> the 'internals' list?
>

I feel its something do with your DNS settings and/or the server.

If that's not the problem then just as a temp solution add your SMTP
server's address provided it has a static IP (99.9% it has) to your
/etc/hosts file.

It should not give trouble then.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Temporary failure in name resolution - fsockopen()

am 25.03.2010 14:31:47 von David Lidstone

Nilesh Govindarajan wrote:
> On 03/25/2010 03:51 PM, David Lidstone wrote:
>> We recently para-virtualised a Xen / CentOS box which is running script
>> which uses fsockopen() to get a connection to an SMTP server.
>>
>> Since the server changes it fails approx 50% of the time with:
>>
>> "php_network_getaddresses: getaddrinfo failed: Temporary failure in name
>> resolution"
>>
>> We've tried the solutions from Googling this error (such as restarting
>> Apache etc), but without success.
>>
>> Why am I wasting your time with a Linux upgrade issue? Well,
>> gethostbyname() seems to resolve the IP every time. Manual lookups on
>> from the server seem to work with no problems.
>>
>> Any help greatly appreciated. Should I perhaps be pointing this out on
>> the 'internals' list?
>>
>
> I feel its something do with your DNS settings and/or the server.
>
> If that's not the problem then just as a temp solution add your SMTP
> server's address provided it has a static IP (99.9% it has) to your
> /etc/hosts file.
>
> It should not give trouble then.
>

Thanks for your suggestion Nilesh, but the hosts file would seem to just
defeat the object of being able to look up DNS addresses.

It is possible to by-pass the issue by using gethostbyname() and just
passing in the IP, but this is not really a solution (e.g. we regularly
use a PEAR package which is now effected). The real questions in my mind
are:

"If there is a reliable call to resolve IPs, then what is fsockopen()
doing which is different? Given the recurrence of this error over the
last 8 - 9 years, can it be changed to improve reliability, or is this
just a one-off with our server?"

I do agree that it is almost certainly an issue with the server or a
library being used (me != serverexpert). But what and why and can PHP
work around this better internally? Thanks again.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Temporary failure in name resolution - fsockopen()

am 25.03.2010 19:18:50 von Nilesh Govindrajan

On 03/25/2010 07:01 PM, David Lidstone wrote:
> Nilesh Govindarajan wrote:
>> On 03/25/2010 03:51 PM, David Lidstone wrote:
>>> We recently para-virtualised a Xen / CentOS box which is running script
>>> which uses fsockopen() to get a connection to an SMTP server.
>>>
>>> Since the server changes it fails approx 50% of the time with:
>>>
>>> "php_network_getaddresses: getaddrinfo failed: Temporary failure in name
>>> resolution"
>>>
>>> We've tried the solutions from Googling this error (such as restarting
>>> Apache etc), but without success.
>>>
>>> Why am I wasting your time with a Linux upgrade issue? Well,
>>> gethostbyname() seems to resolve the IP every time. Manual lookups on
>>> from the server seem to work with no problems.
>>>
>>> Any help greatly appreciated. Should I perhaps be pointing this out on
>>> the 'internals' list?
>>>
>>
>> I feel its something do with your DNS settings and/or the server.
>>
>> If that's not the problem then just as a temp solution add your SMTP
>> server's address provided it has a static IP (99.9% it has) to your
>> /etc/hosts file.
>>
>> It should not give trouble then.
>>
>
> Thanks for your suggestion Nilesh, but the hosts file would seem to just
> defeat the object of being able to look up DNS addresses.
>
> It is possible to by-pass the issue by using gethostbyname() and just
> passing in the IP, but this is not really a solution (e.g. we regularly
> use a PEAR package which is now effected). The real questions in my mind
> are:
>
> "If there is a reliable call to resolve IPs, then what is fsockopen()
> doing which is different? Given the recurrence of this error over the
> last 8 - 9 years, can it be changed to improve reliability, or is this
> just a one-off with our server?"
>
> I do agree that it is almost certainly an issue with the server or a
> library being used (me != serverexpert). But what and why and can PHP
> work around this better internally? Thanks again.

One point to be noted here is that you're using CentOS. CentOS has very
old packages and libraries. So that could be a reason. I don't deny that
CentOS is a free alternative to most used RHEL, but still old is old,
new is new. Old is gold doesn't apply in the IT world.

Try upgrading to a new version or use Arch Linux / Gentoo to get the
latest software and libraries.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Temporary failure in name resolution - fsockopen()

am 25.03.2010 21:02:48 von hSiplu

--001636e909e6f069450482a58708
Content-Type: text/plain; charset=UTF-8

For faster dns lookup you can install dnsmasq package and make the local
server cache.
May be that'll solve your problem and the server will be faster.


Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

--001636e909e6f069450482a58708--