Subject: | Net::DNS::Resolver->retrans does not accept a value of 1 (uses 2 instead) |
Date: | Fri, 25 Jul 2014 17:57:01 +0200 |
To: | "bug-Net-DNS [...] rt.cpan.org" <bug-Net-DNS [...] rt.cpan.org> |
From: | Thomas Erhardt <Thomas.Erhardt [...] n3k.de> |
Hi,
I think I did find an issue with Net::DNS::Resolver's retransfer which always seems to use a minimum of 2 seconds.
-Net::DNS Version: tried 0.66 and 0.78
-Perl Version: 5.8.8
-OS: RedHat Linux 5.9
-Sample Code:
qipadmin@runIP200:/var/tmp> cat lookup-min.pl
#!/usr/bin/perl -w
use strict;
use Net::DNS;
my @anycast_addresses;
### configuration - start
push @anycast_addresses, "10.10.10.18";
my $resolver_retry = 2;
my $resolver_retrans = 1;
### configuration - end
my $res = Net::DNS::Resolver->new();
$res->nameservers(@anycast_addresses);
$res->retry($resolver_retry);
$res->retrans($resolver_retrans);
my $version = ${Net::DNS::VERSION};
my $time = localtime(time);
print "$time - sending query using Net::DNS $version\n";
my $query = $res->send("127.0.0.1");
$time = localtime(time);
if ($query) {
print "$time - received response\n";
} else {
print "$time - query failed: ", $res->errorstring, "\n";
}
qipadmin@runIP200:/var/tmp>
-Expected result (as 10.10.10.18 is not reachable):
* 2 Queries for 1.0.0.127.in-addr.arpa are sent (as $res->retry is set to 2)
* 2nd query is sent one second after 1st (as $res->retrans is set to 1)
Test:
qipadmin@runIP200:/var/tmp> tcpdump -nn host 10.10.10.18 &
[1] 6486
qipadmin@runIP200:/var/tmp> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
qipadmin@runIP200:/var/tmp> ./lookup-min.pl
Fri Jul 25 17:45:34 2014 - sending query using Net::DNS 0.66
17:45:34.874533 IP 192.168.32.64.53898 > 10.10.10.18.53: 59695+ PTR? 1.0.0.127.in-addr.arpa. (40)
17:45:36.875742 IP 192.168.32.64.53898 > 10.10.10.18.53: 59695+ PTR? 1.0.0.127.in-addr.arpa. (40)
Fri Jul 25 17:45:40 2014 - query failed: query timed out
qipadmin@runIP200:/var/tmp> fg
tcpdump -nn host 10.10.10.18
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
qipadmin@runIP200:/var/tmp>
-Actual result:
* 2 Queries are sent (good)
* 2nd query happens 2 seconds after 1st query as you can see from the tcpdump timestamps but should happen after 1s due to the retransfer setting - is this a bug or intended behaviour?
-Additional Remarks:
* 2nd query times out after 4 seconds (exponential backoff?) resulting in a total timeout of 6s.
* I reckon $res->udp_timeout (not used here) controls to timeout of one $res->send and not of the individual retries within that send
Regards
Thomas
Message body is not shown because it is too large.