Subject: | Net::DNS::Resolver stops working when multiple instances are created |
Date: | Wed, 13 Aug 2014 19:55:44 +0200 |
To: | bug-Net-DNS [...] rt.cpan.org |
From: | Moritz Lenz <moritz.lenz [...] noris.de> |
Net::DNS::Resolver doesn't seem to tolerate multiple instances anymore:
$ cat test.pl
use 5.014;
use Net::DNS;
my $dummy = Net::DNS::Resolver->new(nameservers => ['dns.adidas.noris.de']);
my $resolv = Net::DNS::Resolver->new(nameservers => ["dns3.noris.net"]);
my $packet = Net::DNS::Packet->new("adidas.com", "NS");
my $result = $resolv->send($packet);
say $result ? 'yes' : 'no';
On version 0.78 of Net::DNS, this says always "no", but when I remove the line
my $dummy = Net::DNS::Resolver->new(nameservers => ['dns.adidas.noris.de']);
then it says "yes". In the error case, $resolve->errorstring is "no nameservers".
(Background: dns.adidas.noris.de is the hidden primary, and dns3.noris.net one of the hosts behind the loadbalancer that acts as the public primary; from where I test it, dns.adidas.noris.de is reachable. I have no idea if this matters, since the program doesn't actually *do* anything with that dummy object).
The last working version seems to be 0.77:
$ PERL5LIB=$HOME/net-dns/Net-DNS-0.77/blib/lib perl test.pl
yes
$ PERL5LIB=$HOME/net-dns/Net-DNS-0.78/blib/lib perl test.pl
no
$ PERL5LIB=$HOME/net-dns/Net-DNS-0.78_2/blib/lib perl test.pl
no
$ PERL5LIB=$HOME/net-dns/Net-DNS-0.77_2/blib/lib perl test.pl
no
$ PERL5LIB=$HOME/net-dns/Net-DNS-0.77_1/blib/lib perl test.pl
no
This is a bug, because Net::DNS::Resolver intances should be independent from each other.
A fix would be greatly appreciated :-)
Cheers,
Moritz Lenz