Skip Menu |
 

This queue is for tickets about the Mail-SPF CPAN distribution.

Report information
The Basics
Id: 110055
Status: new
Priority: 0/
Queue: Mail-SPF

People
Owner: Nobody in particular
Requestors: mark.johnson [...] network-box.com
Cc:
AdminCc:

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



MIME-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\))
X-Spam-Status: No, score=-2.609 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
X-Scanned-BY-Nbmailscanhq1: Virus scan performed by network-box
X-Scanned-BY-Nbmailscanhq1: Scanner file id is nbmailscanhq1-1449209004.997-26023-000
X-Scanned-BY-Nbmailscanhq1: No known viruses found in message (received+scanned in 0.07/0.10 secs)
X-Scanned-BY-Nbmailscanhq1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0
X-Mailer: Apple Mail (2.3096.5)
X-Networkbox-Signature-Group-Networkboxhq: 0501;GROUP;networkboxhq;nbitphk2;f9e9f618409664b3989ab0d10c253862f8711d769a69effe303da13eaf24b1ba
X-Spam-Flag: NO
X-Virus-Checked: Checked
X-Scanned-BY-Nbitphk2: eMail scan performed by network-box
X-Scanned-BY-Nbitphk2: Network Box scan job c4d7529d-6abf-4b9a-b279-999a5fb82e90
X-Scanned-BY-Nbitphk2: Network Box message id 8f2b3344-9be7-498c-8543-faf1ff7fa320
Message-ID: <4FBD26A9-07A1-49B2-AD76-27C42A7D1DC8 [...] network-box.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_5D200FDB-1802-43DD-9877-4ACD8F832678"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Networkbox-Hamsign: 0101;OUT;nbmailscanhq1;2b12cb599385cb289d40e16cc8968ddd;
X-Spam-Score: -2.609
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 8951E2402CB for <cpan-bug+Mail-SPF [...] hipster.bestpractical.com>; Fri, 4 Dec 2015 01:03:41 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wp0rUhxbxq+A for <cpan-bug+Mail-SPF [...] hipster.bestpractical.com>; Fri, 4 Dec 2015 01:03:39 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0A5A62402C6 for <bug-Mail-SPF [...] rt.cpan.org>; Fri, 4 Dec 2015 01:03:38 -0500 (EST)
Received: (qmail 32210 invoked by alias); 4 Dec 2015 06:03:38 -0000
Received: from erika.network-box.com (HELO nbmailscanhq1.network-box.com) (202.52.42.180) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 03 Dec 2015 22:03:31 -0800
Received: (qmail 26033 invoked from network); 4 Dec 2015 06:03:25 -0000
Received: from unknown (HELO ?10.8.2.100?) (10.8.2.100) by 10.12.18.180 with SMTP; 4 Dec 2015 06:03:25 -0000
Delivered-To: cpan-bug+Mail-SPF [...] hipster.bestpractical.com
Subject: Memory leak in Mail::SPF::MacroString
Return-Path: <mark.johnson [...] network-box.com>
X-RT-Mail-Extension: mail-spf
X-Original-To: cpan-bug+Mail-SPF [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
X-Old-Spam-Status: No
Date: Fri, 4 Dec 2015 14:03:18 +0800
X-Spam-Level:
X-Networkbox-Bouncesign-NBHQHK: 0101;16773;83b061ec
To: bug-Mail-SPF [...] rt.cpan.org
From: Mark Webb-Johnson <mark.johnson [...] network-box.com>
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 2848
Download (untitled) / with headers
text/plain 2.7k
The following example code shows a memory leak in Mail::SPF::MacroString. #!/usr/bin/perl use Mail::SPF; use Net::DNS::Resolver; my $resolver = Net::DNS::Resolver->new(retry=>3, retrans=>2); my $engine = Mail::SPF::Server->new(dns_resolver => $resolver, max_void_dns_lookups => 2); foreach (1 .. 100) { my $request = Mail::SPF::Request->new ( versions => [1,2], scope => 'mfrom', identity => 'joe@microsoft.com', helo_identity => 'microsoft.com', ip_address => '1.2.3.4' ); my $result = $engine->process($request); } $engine = undef; $resolver = undef; use Devel::Gladiator qw(walk_arena arena_ref_counts arena_table); foreach (split /\n/,arena_table()) { print $_,"\n"; } Example output is: ARENA COUNTS: 127743 SCALAR 37991 REF 11608 REF-NetAddr::IP 10707 NetAddr::IP 9406 Mail::SPF::Mech::IP4 9406 REF-Mail::SPF::Mech::IP4 5209 ARRAY 3705 REF-Mail::SPF::Request 3063 GLOB 2902 Mail::SPF::MacroString 2902 REF-Mail::SPF::MacroString 2795 HASH 2460 REF-ARRAY 2246 REF-HASH 1904 REF-Mail::SPF::Server 1372 CODE 1001 Mail::SPF::Request 1001 Mail::SPF::v1::Record 1001 REF-Mail::SPF::v1::Record 1000 Mail::SPF::Mech::All 1000 Mail::SPF::Mech::Include 1000 REF-Mail::SPF::Mech::All 1000 REF-Mail::SPF::Mech::Include 349 REF-SCALAR 200 Mail::SPF::Mech::IP6 200 REF-Mail::SPF::Mech::IP6 81 REF-Regexp 81 Regexp 43 REF-utf8 38 REF-version 38 version 30 REF-REF 23 utf8 8 LVALUE 6 IO::Handle 6 REF-Encode::XS 4 Encode::XS 3 REF-Encode::utf8 2 Encode::utf8 2 FORMAT 2 REF-Mail::SPF::Result::Fail 1 Config 1 Encode::Internal 1 Errno 1 Mail::SPF::EInvalidRecordVersion 1 Mail::SPF::Result::Fail 1 Mail::SPF::Result::NeutralByDefault 1 Mail::SPF::Server 1 Net::DNS::Resolver 1 REF-CODE 1 REF-Config 1 REF-Encode::Internal 1 REF-Errno 1 REF-Mail::SPF::EInvalidRecordVersion 1 REF-Mail::SPF::Result::NeutralByDefault 1 REF-Net::DNS::Resolver Issue seems to be the common perl circular reference when passing the ‘server' and ‘request' references. An ugly patch (using Scalar::Util weaken) is: diff -ur lib/Mail/SPF/MacroString.pm lib~/Mail/SPF/MacroString.pm --- a/lib/Mail/SPF/MacroString.pm 2012-01-30 08:59:22.000000000 +0000 +++ b/lib/Mail/SPF/MacroString.pm 2015-12-04 05:37:43.520031685 +0000 @@ -32,6 +32,8 @@ use Mail::SPF::Util; +use Scalar::Util 'weaken'; + use constant TRUE => (0 == 0); use constant FALSE => not TRUE; @@ -135,6 +137,8 @@ $self = $self->SUPER::new(%options); defined($self->{text}) or throw Mail::SPF::EOptionRequired("Missing required 'text' option"); + weaken($self->{'server'}); + weaken($self->{'request'}); return $self; } But, not elegant. Regards.
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 16122
Download (untitled) / with headers
text/html 15.7k

Message body is not shown because it is too large.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.