Bug 1151572 - Runaway rapid memory growth when handling Net::DNS::Packet
Summary: Runaway rapid memory growth when handling Net::DNS::Packet
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-Net-DNS
Version: 20
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Petr Šabata
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-10 17:42 UTC by John McEleney
Modified: 2014-11-13 18:19 UTC (History)
3 users (show)

Fixed In Version: perl-Net-DNS-0.81-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-10 06:20:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
CPAN 99429 0 None None None Never

Description John McEleney 2014-10-10 17:42:56 UTC
Description of problem:

When I query the NS records for a certain domain using Net::DNS::Resolver::Recurse, the perl script gets stuck in a infinite loop, rapidly expanding in size until it is killed by the OOM killer.

How reproducible:
Can be reproduced every time you query certain domain(s). I've reproduced it on four different Fedora 20 systems, once of which was a virgin system booted from the Fedora Live DVD.

The problem does _not_ occur on CentOS/RHEL 6.5 or CentOS/RHEL 7.


Steps to Reproduce:
1. Create a perl script that queries NS records for domain villamontanavista.co.uk
2. Run the script
3. Watch top and see the script grow in size until the OOM killer steps in.

Actual results:
Perl script devours all available memory until it is killed by OOM Killer

Expected results:
DNS records should be handled by the script and it should exit almost instantly

Additional info:
This perl script will always trigger the bug on Fedora 20:
=========================
#!/usr/bin/perl

use strict;
use Net::DNS;
use Net::DNS::Resolver::Recurse;
use Data::Dumper;

select STDERR; $| = 1;
select STDOUT; $| = 1;

my $res = Net::DNS::Resolver::Recurse->new;
$res->hints();
$res->recursion_callback(sub {
    my $packet = shift;
    print "==============\n".Dumper($packet)."\n--------------------\n";
    for  ($packet->additional){ print $_->string."\n"; }
});

$res->tcp_timeout(10);
$res->udp_timeout(10);

print "Starting recursion\n";
my $packet=$res->query_dorecursion("villamontanavista.co.uk","NS");
print "Finished recursion\n";
=========================

Some strace output (goes on like this until killed):
brk(0)                                  = 0x18a1000
brk(0x18c2000)                          = 0x18c2000
brk(0)                                  = 0x18c2000
brk(0x18e3000)                          = 0x18e3000
brk(0)                                  = 0x18e3000
brk(0x1904000)                          = 0x1904000
brk(0)                                  = 0x1904000
brk(0x1925000)                          = 0x1925000
brk(0)                                  = 0x1925000
brk(0x1946000)                          = 0x1946000
brk(0)                                  = 0x1946000
brk(0x1967000)                          = 0x1967000
brk(0)                                  = 0x1967000
brk(0x1988000)                          = 0x1988000
brk(0)                                  = 0x1988000

Comment 1 John McEleney 2014-10-11 10:36:08 UTC
I've done a bit more work on this and determined that:

* The problem exists in the upstream Net::DNS v0.80
* This can be reproduced on Ubuntu Trusty with Net::DNS built from CPAN

I've reported the bug here:
https://rt.cpan.org/Public/Bug/Display.html?id=99429

Comment 2 Petr Šabata 2014-10-13 13:10:48 UTC
Thanks for the report, John.

A workaround patch has been submitted on RT.

Comment 3 Paul Wouters 2014-10-29 15:27:15 UTC
confirmed fixed in 0.81

Comment 4 Fedora Update System 2014-10-29 15:47:34 UTC
perl-Net-DNS-0.81-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/perl-Net-DNS-0.81-1.fc19

Comment 5 Fedora Update System 2014-10-29 15:52:09 UTC
perl-Net-DNS-0.81-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/perl-Net-DNS-0.81-1.fc21

Comment 6 Fedora Update System 2014-10-31 01:27:48 UTC
Package perl-Net-DNS-0.81-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing perl-Net-DNS-0.81-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-13988/perl-Net-DNS-0.81-1.fc21
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-11-10 06:20:25 UTC
perl-Net-DNS-0.81-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2014-11-13 18:19:24 UTC
perl-Net-DNS-0.81-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.