Skip Menu |

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

Report information
The Basics
Id: 97736
Status: resolved
Worked: 1.7 hours (100 min)
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: jwagner [...] hexonet.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.75_1
  • 0.76
  • 0.76_1
  • 0.76_2
  • 0.76_3
  • 0.77
  • 0.77_1
  • 0.77_2
  • 0.78
  • 0.78_1
Fixed in: (no value)



Subject: Bug in Net::DNS::Resolver::Base
Date: Mon, 04 Aug 2014 11:48:11 +0200
To: bug-Net-DNS [...] rt.cpan.org
From: Jens Wagner <jwagner [...] hexonet.net>
Dear Team of Net::DNS, there is a Bug in Net/DNS/Resolver/Base.pm, that can be fixed using the patch attached to this email. Version of Net-DNS used: 0.78 Issue: The constructor "sub new" does not properly copy the $defaults hash reference, before making changes, therefore independent Net::DNS::Resolver objects affect each other. The fix is to simply apply a deep copy on the $defaults hash ref. Example code triggering the bug: # ------------------------------------------------------------------ use Net::DNS; my $resolver = new Net::DNS::Resolver ( nameservers => ['some-non-existing-ns.'], recurse => 0, ); my $resolver2 = new Net::DNS::Resolver ( nameservers => ['ns1.hexonet.net.'], recurse => 0, debug => 1 ); $resolver2->query("www.hexonet.net."); # ------------------------------------------------------------------ $resolver2 does not work, as 'ns1.hexonet.net.' doesn't get resolved. (because the $resolver constructor above overwrote the $defaults). $resolver2 works however, when removing $resolver, or applying the patch. Please let me know, if you need further infos. And thanks a lot for maintaining Net::DNS + Net::DNS::SEC! Best, - jens -- Jens Wagner Chief Executive Officer HEXONET GmbH T: +49 6841 69 84 0 F: +49 6841 69 84 199 E: jwagner@hexonet.net W: http://www.hexonet.net HEXONET GmbH, Talstrasse 27, 66424 Homburg, Germany. CEO & General Manager: Jens Wagner, HRB 2839 (HOM), Amtsgericht Saarbrücken, VAT-ID: DE-138316882 HEXONET Services Inc., #2235 - 6900 Graybar Road, Richmond, B.C., V6W 0A5, Canada. CSO & General Manager: Robert Birkner This email and any files transmitted are confidential and intended only or the person(s) directly addressed. If you are not the intended recipient, any use, copying, transmission, distribution, or other forms of dissemination is strictly prohibited. If you have received this email in error, please notify the sender immediately and permanently delete this email with any files that may be attached.

Message body is not shown because sender requested not to inline it.

Jens, Actually, this issue just barely started happening in version 0.75_1. And yes, your patch seems to help with the problem, but I don't like the dependency on Storable.pm. I recommend we just revert it back to the old lazy one-deep "clone" behavior as was used in revision 0.75 and earlier: --- Net/DNS/Resolver/Base.pm.ORIG 2014-07-31 01:38:18.000000000 +0400 +++ Net/DNS/Resolver/Base.pm 2014-08-05 02:48:28.429378633 +0400 @@ -157,7 +157,7 @@ my %args = @_ unless scalar(@_) % 2; my $self; - my $base = $class->defaults; + my $base = { %{ $class->defaults } }; my $init = $initial; $initial ||= bless {%$base}, $class; if ( my $file = $args{'config_file'} ) { (This is the patch we are using as a work-around on our servers until the new revision can be posted to CPAN.) Thank you for your excellent report! -- Rob Brown
From: rwfranks [...] acm.org
On Mon Aug 04 05:48:24 2014, jwagner@hexonet.net wrote: Show quoted text
> Dear Team of Net::DNS, > > there is a Bug in Net/DNS/Resolver/Base.pm, that can be fixed using the > patch attached to this email. >
You are correct in thinking that this is a bug. However, it cannot be fixed in the way you describe without reintroducing RT#96608, which is what this horrible bit of code is all about. It will be fixed properly in 0.79
Subject: Re: [rt.cpan.org #97736] Bug in Net::DNS::Resolver::Base
Date: Tue, 05 Aug 2014 10:23:22 +0200
To: bug-Net-DNS [...] rt.cpan.org
From: Jens Wagner <jwagner [...] hexonet.net>
Hi Rob, Show quoted text
> Jens, > > Actually, this issue just barely started happening in version 0.75_1. > > And yes, your patch seems to help with the problem, but I don't like the dependency on Storable.pm. > > I recommend we just revert it back to the old lazy one-deep "clone" behavior as was used in revision 0.75 and earlier: > > --- Net/DNS/Resolver/Base.pm.ORIG 2014-07-31 01:38:18.000000000 +0400 > +++ Net/DNS/Resolver/Base.pm 2014-08-05 02:48:28.429378633 +0400 > @@ -157,7 +157,7 @@ > my %args = @_ unless scalar(@_) % 2; > > my $self; > - my $base = $class->defaults; > + my $base = { %{ $class->defaults } }; > my $init = $initial; > $initial ||= bless {%$base}, $class; > if ( my $file = $args{'config_file'} ) { > > > (This is the patch we are using as a work-around on our servers until the new revision can be posted to CPAN.) > > Thank you for your excellent report! > > -- Rob Brown
That fix works for me. Thank you! Btw, to confirm the issue, it's also sufficient to: use Net::DNS::Resolver; use Data::Dumper; Net::DNS::Resolver->init(); print STDERR Dumper(Net::DNS::Resolver::Base::->defaults()->{nameserver4}); my $resolver = new Net::DNS::Resolver (nameservers => ['some-non-existing-ns.']); print STDERR Dumper(Net::DNS::Resolver::Base::->defaults()->{nameserver4}); Best, - jens
Subject: Re: [rt.cpan.org #97736] Bug in Net::DNS::Resolver::Base
Date: Tue, 05 Aug 2014 10:34:47 +0200
To: bug-Net-DNS [...] rt.cpan.org
From: Jens Wagner <jwagner [...] hexonet.net>
Hi Dick, Show quoted text
> You are correct in thinking that this is a bug. However, it cannot be > fixed in the way you describe without reintroducing RT#96608, which is > what this horrible bit of code is all about. It will be fixed properly > in 0.79
understood. Thank you! Best, - jens
Fixed on trunk and will be in 0.79.