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 | 09/22/2008 (6131 days ago) |
Due | 09/22/2008 (6131 days ago) |
Updated | 05/01/2009 (5910 days ago) |
Assigned | 11/11/2008 (6081 days ago) |
Resolved | 04/04/2009 (5937 days ago) |
Milestone | 3.3.4 |
Patch | Yes |
http://cvs.horde.org/diff.php/horde/test.php?rt=horde&r1=1.122.6.29&r2=1.122.6.30&ty=u
http://cvs.horde.org/diff.php/horde/test.php?rt=horde&r1=1.179&r2=1.180&ty=u
Assigned to Jan Schneider
Taken from
http://cvs.horde.org/diff.php/framework/Auth/Auth.php?rt=horde&r1=1.142.10.34&r2=1.142.10.35&ty=u
http://cvs.horde.org/diff.php/framework/MIME/MIME/Attic/Headers.php?rt=horde&r1=1.29.10.28&r2=1.29.10.29&ty=u
http://cvs.horde.org/diff.php/framework/NLS/NLS.php?rt=horde&r1=1.82.4.22&r2=1.82.4.23&ty=u
http://cvs.horde.org/diff.php/horde/admin/sessions.php?rt=horde&r1=1.2.2.7&r2=1.2.2.8&ty=u
http://cvs.horde.org/diff.php/horde/config/conf.xml?rt=horde&r1=1.74.2.83&r2=1.74.2.84&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.515.2.521&r2=1.515.2.522&ty=u
http://cvs.horde.org/diff.php/horde/docs/INSTALL?rt=horde&r1=1.90.6.22&r2=1.90.6.23&ty=u
http://cvs.horde.org/diff.php/framework/Auth/Auth.php?rt=horde&r1=1.202&r2=1.203&ty=u
http://cvs.horde.org/diff.php/framework/NLS/NLS.php?rt=horde&r1=1.128&r2=1.129&ty=u
http://cvs.horde.org/diff.php/horde/admin/sessions.php?rt=horde&r1=1.17&r2=1.18&ty=u
http://cvs.horde.org/diff.php/horde/config/conf.xml?rt=horde&r1=1.250&r2=1.251&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.1221&r2=1.1222&ty=u
http://cvs.horde.org/diff.php/horde/docs/INSTALL?rt=horde&r1=1.135&r2=1.136&ty=u
New Attachment: net_dns_FRAMEWORK_3.patch
some of those places provide more useful data to users.
of those are externally provided hostnames, e.g. when doing country
lookups etc.
value to justify the multiple possible delays?
immediate reload is successful most of the time.
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.
New Attachment: net_dns_v3.patch
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.
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?
State ⇒ Assigned
Milestone ⇒ 3.3.1
Patch ⇒ Yes
New Attachment: net_dns_v2.patch
New Attachment: net_dns.patch
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?
New Attachment: sessions.php.patch
New Attachment: Headers.php.patch
New Attachment: NLS.php.patch
New Attachment: Auth.php.patch
<?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";
?>
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";
?>
http://pear.php.net/manual/en/package.networking.net-dns.net-dns-resolver.query.php
See $retry and $retrans
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
http://us2.php.net/manual/en/function.gethostbyaddr.php#46869 is the
only thing I see. This feels awfully hackish though.
the IP address?
- 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.
State ⇒ Feedback
the IP address?
State ⇒ New
Priority ⇒ 2. Medium
Type ⇒ Enhancement
Summary ⇒ speed up hostname lookups on broken DNS
Due ⇒ 09/22/2008
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
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