Blocking gethostbyname and Net_DNS2 behaviour
| From: | a m | Date: | Tue, 11 Sep 2012 11:22:51 +0000 |
| Subject: | Blocking gethostbyname and Net_DNS2 behaviour | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-319034@lists.php.net to get a copy of this message | ||
Hi,
I was using gethostbyname up until recently but switched to Net_DNS2
due to lack of support for a timeout. Now I discovered some "worrying"
behaviour and hope someone here get shed some light onto it.
I am running PHP inside an Apache 2 installation as module and noticed
that once I call gethostbyname it appears to block all other
concurrent independent requests to PHP pages until the call returned.
I do seem to remember that there were some reentrant issues with the
native gethostbyname function but I wouldnt assume there is some kind
of global lock on it blocking the entire runtime.
What is even more worrying is that Net_DNS2 appears to show the same
behaviour, even though from my understanding it is supposed to work
completely independent with its own streams/sockets.
Of course this behaviour only shows with a domain with non-responding
name servers, hence I used vuav.com. You should be able to reproduce
it easily with
<?php
echo gethostbyname('vuav.com');
// OR ......
require('Net/DNS2.php');
$dr=new Net_DNS2_Resolver(['nameservers'=>['8.8.8.8']]);
$ans=$dr->query('vuav.com');
echo $ans->answer[0]->address;
?>
Could it have to do something with a configuration setting or might I
be onto something?
Thanks a lot!
cheers,
Alexander