Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0

Bug #20266 Blocking UDP read MSG_WAITALL blocks forever with faulty DNS sercer
Submitted: 2014-05-06 14:21 UTC
From: evyncke Assigned:
Status: Open Package: Net_DNS2 (version 1.3.2)
PHP Version: 5.4.6 OS: Ubuntu
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 37 - 22 = ?

 
 [2014-05-06 14:21 UTC] evyncke (Eric Vyncke)
Description: ------------ In Sockets.php, in function read(), there is a call to socket_recv with MSG_WAITALL which causes problem when the DNS server sends back a shorter reply than expected. In the test script below, the server is clearly badly behaving but there is no reason why my PHP script should wait forever ;-) Thanks in advance Test script: --------------- <? require_once('Net/DNS2.php'); $res = new Net_DNS2_Resolver(); $res->setServers(array("2001:d08:111:200::80")) ; $res->timeout = 2 ; // default is 5 $res->recurse = FALSE ; // Do not ask for recursive try { $response = $res->query("klse.com.my", "SOA") ; } catch(Net_DNS2_Exception $e) { print("No answer from DNS") ; } print("Got a reply") ; ?> Expected result: ---------------- Throwing an exception with 'timeout' Actual result: -------------- Waiting forever hence blocking forever my script

Comments

 [2014-05-08 02:50 UTC] mikepultz (Mike Pultz)
Do you have an example of a broken DNS server? It's hard to replicate without that. Mike
 [2014-05-08 03:31 UTC] evyncke (Eric Vyncke)
See the test script :-)
 [2014-05-08 03:46 UTC] mikepultz (Mike Pultz)
Hey Eric, Sorry, I should have said, I don't have a way to route to a IPv6 server; does that same server have a IPv4 interface? Mike
 [2014-05-08 15:37 UTC] evyncke (Eric Vyncke)
The same broken server has an IPv4 address as well (it is ens1.bursamalaysia.com.) but is seems that the IPv4 part works fine, it is only the IPv6 reply which is shorter than expected :-(
 [2014-05-09 01:57 UTC] mikepultz (Mike Pultz)
ok- well- i'll see if I can re-create it some other way. Mike