Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 31425
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: OLAF [...] cpan.org
Requestors: Pascal.Antz [...] afp.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.61
Fixed in: (no value)



Description : when I run 10, 100, or 1000 times the following programm (A), it's working fine. But sometimes, I get a DNS "Server Failure" from the Name Server. --> When receiving this packet, program is aborting whit an error message (B). File joined : Wireshark capture of packet exchange. # (A) ############# PERL CODE ######################################## use strict; use Net::DNS; my $site = "www.cisco.com"; my $nameServer = "4.2.2.1"; my $res = Net::DNS::Resolver->new; $res->nameservers($nameServer); # +--------------------------------+ # | PROGRAMM ABORTED AT THIS POINT | # +--------------------------------+ my $query = $res->search("$site."); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "A"; print $rr->address, "\n"; } } else { warn "query failed: ", $res->errorstring, "\n"; } # (B) ################# ERROR CODE ########################### Can't call method "qtype" on an undefined value at C:/Perl/site/lib/Net/DNS/Resolver/Base.pm line 434, <FILE> line 1.
Subject: failure.pcap
Download failure.pcap
application/octet-stream 189b

Message body not shown because it is not plain text.

Subject: More precision on ABORT POINT
From: Pascal.Antz [...] afp.com
Le Mer. Déc. 12 13:18:31 2007, PAntz a écrit : Show quoted text
> Description : when I run 10, 100, or 1000 times the following programm > (A), it's working fine. But sometimes, I get a DNS "Server Failure" from > the Name Server. > --> When receiving this packet, program is aborting whit an error > message (B). > File joined : Wireshark capture of packet exchange. > > # (A) ############# PERL CODE ######################################## > use strict; > use Net::DNS; > > my $site = "www.cisco.com"; > my $nameServer = "4.2.2.1"; > > my $res = Net::DNS::Resolver->new; > $res->nameservers($nameServer); > > # +-------------------------------------+ > # | PROGRAMM ABORTED BETWEEN THIS POINT | > # +-------------------------------------+ > > my $query = $res->search("$site.");
>> >> # +-------------------------------------+ >> # | PROGRAMM ABORTED AND THIS POINT | >> # +-------------------------------------+
> if ($query) { > foreach my $rr ($query->answer) { > next unless $rr->type eq "A"; > print $rr->address, "\n"; > } > } else { > warn "query failed: ", $res->errorstring, "\n"; > } > # (B) ################# ERROR CODE ########################### > > Can't call method "qtype" on an undefined value at > C:/Perl/site/lib/Net/DNS/Resolver/Base.pm line 434, <FILE> line 1.
Show quoted text
> > Can't call method "qtype" on an undefined value at > > C:/Perl/site/lib/Net/DNS/Resolver/Base.pm line 434, <FILE> line 1.
I have not been able to reproduce the problem but line 434 is a clear indication of where the bug is. I happens to live in this little loop: foreach my $suffix ( @list ) { my $fqname = join '.', $name, ($suffix || ()); print ';; search(', join(', ', $fqname, @_), ")\n" if $self->{debug}; my $packet = $self->send($fqname, @_) || return undef; return $packet if $packet->header->ancount; # answer found last if ($packet->question)[0]->qtype eq 'PTR'; # abort search if IP } Before looking into the question section the program does not check if there is actually a question section around. The packet you mailed was sufficiently mallformed to not have a question section. The (untested) solution is take the next suffix from the loop if the response contains anything else than an errorcode NOERROR, and test for the existence of a question section. Solved in the forthcoming 0.62
Subject: RE : [rt.cpan.org #31425] Resolved:
Date: Fri, 28 Dec 2007 14:57:10 +0100
To: <bug-Net-DNS [...] rt.cpan.org>
From: "Pascal ANTZ" <Pascal.ANTZ [...] afp.com>
Hi Olaf, Thanks for correction. I will download 0.62 a soon as available on CPAN website, for testing purpose. I will keep you informed if you like. Best Regards, Pascal -------- Message d'origine-------- De: Olaf Kolkman via RT [mailto:bug-Net-DNS@rt.cpan.org] Date: ven. 28/12/2007 11:31 À: Pascal ANTZ Objet : [rt.cpan.org #31425] Resolved: <URL: http://rt.cpan.org/Ticket/Display.html?id=31425 > According to our records, your request has been resolved. If you have any further questions or concerns, please respond to this message. This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com