6.0.0-git
2019-03-23

[#7374] speed up hostname lookups on broken DNS
Summary speed up hostname lookups on broken DNS
Queue Horde Framework Packages
Queue Version HEAD
Type Enhancement
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester adrieder (at) sbox (dot) tugraz (dot) at
Created 2008-09-22 (3834 days ago)
Due 09/22/2008 (3834 days ago)
Updated 2009-05-01 (3613 days ago)
Assigned 2008-11-11 (3784 days ago)
Resolved 2009-04-04 (3640 days ago)
Milestone 3.3.4
Patch Yes

History
2009-05-01 18:04:43 CVS Commit Comment #29 Reply to this comment
2009-05-01 18:01:18 CVS Commit Comment #28 Reply to this comment
2009-04-06 08:19:14 Jan Schneider Comment #27 Reply to this comment
Makes sense.
2009-04-06 06:34:41 Matt Selsky Comment #26 Reply to this comment
Should we add a test for Net_DNS to test.php?
2009-04-04 12:31:54 Jan Schneider State ⇒ Resolved
 
2009-04-04 12:31:11 Jan Schneider Comment #25
Assigned to Jan Schneider
Taken from Horde DevelopersHorde Developers
Reply to this comment
Tweaked and committed, thanks.
2009-04-04 10:15:08 Jan Schneider Deleted Original Message
 
2009-02-09 08:33:13 adrieder (at) sbox (dot) tugraz (dot) at Comment #22
New Attachment: net_dns_FRAMEWORK_3.patch Download
Reply to this comment
here is the patch against FRAMEWORK_3 from cvs.
2009-01-24 18:02:46 Jan Schneider Milestone ⇒ 3.3.4
 
2008-11-11 07:24:27 Chuck Hagenbuch State ⇒ Assigned
 
2008-11-10 02:17:36 Matt Selsky Comment #21 Reply to this comment
I did look and it seemed mostly cosmetic.  Looking closer, I see that 
some of those places provide more useful data to users.
2008-11-10 01:04:10 Jan Schneider Comment #20 Reply to this comment
Of course, did you take a look at places where this patch works? Most 
of those are externally provided hostnames, e.g. when doing country 
lookups etc.
2008-11-10 00:54:06 Matt Selsky Comment #19 Reply to this comment
Does having the hostname, instead of just the IP address, have enough 
value to justify the multiple possible delays?
2008-11-09 23:24:30 Jan Schneider Comment #18 Reply to this comment
I personally have temporary timeouts for whatever reason here. An 
immediate reload is successful most of the time.
2008-11-09 20:10:00 Chuck Hagenbuch State ⇒ Feedback
 
2008-11-09 20:04:11 Matt Selsky Comment #17 Reply to this comment
Is there a real advantage to bothering to retry?  Is it more likely to 
work if tried again?  I think we are just trying to avoid waiting for 
a DNS server that will never respond, so a single try, with any 
timeout shorter than 60 seconds would put it in a better situation.
2008-11-09 10:57:34 adrieder (at) sbox (dot) tugraz (dot) at Comment #16
New Attachment: net_dns_v3.patch Download
Reply to this comment
here is an updated patch, with the defaults set to 2 seconds. 
Personally I think that a name server should always have a fast 
internet connection and the connection between the server running 
horde and the name server will normally also be quite fast.
2008-10-07 13:34:23 arjen+horde (at) de-korte (dot) org Comment #15 Reply to this comment
Defaulting to a 1 second timeout and 1 retry only will result in 
failed hostname lookups on slow connections. Wouldn't it be better to 
use more conservative defaults (5 seconds, 3 retries) and have 
administrators lower these values should they feel this provides a 
better performance?
2008-10-07 12:30:26 Jan Schneider Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Milestone ⇒ 3.3.1
Patch ⇒ Yes
 
2008-10-07 12:30:07 Jan Schneider Deleted Original Message
 
2008-10-07 12:30:01 Jan Schneider Deleted Original Message
 
2008-10-07 12:29:57 Jan Schneider Deleted Original Message
 
2008-10-07 12:29:51 Jan Schneider Deleted Original Message
 
2008-10-02 23:07:08 Chuck Hagenbuch Deleted Original Message
 
2008-10-02 21:55:28 adrieder (at) sbox (dot) tugraz (dot) at Comment #14
New Attachment: net_dns_v2.patch
Reply to this comment
there was a typo in my net_dns.patch please use the net_dns_v2.patch
2008-09-24 19:16:41 adrieder (at) sbox (dot) tugraz (dot) at Comment #13
New Attachment: net_dns.patch
Reply to this comment
attached is a patch which makes the use of Net/DNS optionally. If the 
module is not found it falls back to the php gethostbyaddr. The patch 
also makes the timeouts configurable in horde.

The patch obsoletes the previously uploaded patches.



Is there any chance to have it included into the code base?
2008-09-23 11:55:29 adrieder (at) sbox (dot) tugraz (dot) at Comment #12
New Attachment: sessions.php.patch
Reply to this comment
and finally sessions.php.patch
2008-09-22 19:32:45 adrieder (at) sbox (dot) tugraz (dot) at Comment #11
New Attachment: Headers.php.patch
Reply to this comment
...Headers.php patch
2008-09-22 19:32:06 adrieder (at) sbox (dot) tugraz (dot) at Comment #10
New Attachment: NLS.php.patch
Reply to this comment
...NLS.php patch
2008-09-22 19:19:18 adrieder (at) sbox (dot) tugraz (dot) at Comment #9
New Attachment: Auth.php.patch
Reply to this comment
and here is a patch for Auth.php
2008-09-22 18:10:21 adrieder (at) sbox (dot) tugraz (dot) at Comment #8 Reply to this comment
...and here without setting the RES_OPTIONS env. vars.



<?php

require_once 'Net/DNS.php';



$now = time();



$resolver = new Net_DNS_Resolver();

$resolver->retry = 1;

$resolver->retrans = 1;

$response = $resolver->query('153.19.206.48');

if ($response) {

     foreach ($response->answer as $rr) {

         $rr->display();

     }

}



print time() - $now . "\n";

?>


2008-09-22 18:06:10 adrieder (at) sbox (dot) tugraz (dot) at Comment #7 Reply to this comment
That's it, if using an external pear module it ok :-)



The following cod works fine:



<?php

require_once 'Net/DNS.php';



$resolver = new Net_DNS_Resolver();

$now = time();



putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');

require_once 'Net/DNS.php';



$response = $resolver->query('153.19.206.48');

if ($response) {

     foreach ($response->answer as $rr) {

         $rr->display();

     }

}

print time() - $now . "\n";

?>


2008-09-22 17:56:47 Matt Selsky Comment #6 Reply to this comment
2008-09-22 17:48:00 adrieder (at) sbox (dot) tugraz (dot) at Comment #5 Reply to this comment
after quite a time of searching for a solution I came also to the 
conclusion that this is the only possible way in php to solve this.

The following posting should also be noted:

http://us2.php.net/manual/en/function.gethostbyaddr.php#58970
2008-09-22 17:27:25 Chuck Hagenbuch Comment #4 Reply to this comment
Something like 
http://us2.php.net/manual/en/function.gethostbyaddr.php#46869 is the 
only thing I see. This feels awfully hackish though.
2008-09-22 16:41:42 adrieder (at) sbox (dot) tugraz (dot) at Comment #3 Reply to this comment
How much do we get from doing the lookup, as opposed to just showing
the IP address?
Well I think not much, except that it looks "nicer" in:



- the "last login" line (see ./framework/Auth/Auth.php)

- in the MIME headers of the sent messages (see 
./framework/MIME/MIME/Headers.php)

- in the active sessions view for the admin (see ./admin/sessions.php)



I guess in ./framework/NLS/NLS.php the IP needs to be resolved, so 
"timeoutable" lookup could help most here.


2008-09-22 16:20:04 Chuck Hagenbuch Comment #2
State ⇒ Feedback
Reply to this comment
How much do we get from doing the lookup, as opposed to just showing 
the IP address?
2008-09-22 13:18:48 adrieder (at) sbox (dot) tugraz (dot) at Comment #1
Type ⇒ Enhancement
State ⇒ New
Priority ⇒ 2. Medium
Summary ⇒ speed up hostname lookups on broken DNS
Due ⇒ 2008-09-22
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
There are some strange providers out there who configure there 
nameserver to block DNS-lookups of IPs in their networks so that they 
run into a time out. This is very annoying since the login into 
Horde/IMP takes very long (> 60 sec.) until the gethostbyaddr() calls 
time out. This leads to strange behavior afterwards e.g. IMP can't 
save sent messages in the sent-mail folder or move messages to the 
trash folder (permission denied).



It would by good to have a dns lookup with a short timeout. 
Unfortunately the php gethostbyaddr() function does not have a timeout 
option.



e.g.

<?php

$now = time();

print gethostbyaddr('153.19.206.48') . "\n";

print time() - $now . "\n";

?>

results in:

153.19.206.48

70




Saved Queries