Bug 5880 - MEMORY: Net::DNS "sec" module can use up 5 megs of ram per process needlessly
Summary: MEMORY: Net::DNS "sec" module can use up 5 megs of ram per process needlessly
Status: RESOLVED WONTFIX
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 3.2.4
Hardware: Other All
: P5 enhancement
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-07 08:52 UTC by J. Nick Koston
Modified: 2019-06-24 15:17 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description J. Nick Koston 2008-04-07 08:52:55 UTC
./DNS
./DNS/SEC
./DNS/SEC/Private.pm
./DNS/Update.pm
./DNS/RR
./DNS/RR/NSEC.pm
./DNS/RR/DS.pm
./DNS/RR/SIG.pm
./DNS/RR/NXT.pm
./DNS/RR/RRSIG.pm
./DNS/RR/KEY.pm
./DNS/RR/DNSKEY.pm
./DNS/SEC.pm


I usually create a sandbox for these files and unshift it into the @INC path.
and
just do

package Net::DNS::Sec::Private;
1;

So Net::DNS will just load stubs.
Comment 1 J. Nick Koston 2008-04-16 20:55:46 UTC
Mucking about with $INC might be a better option here.


$INC{'DNS/SEC/Private.pm'} = 'stub';
$INC{'DNS/Update.pm'} = 'stub';
$INC{'DNS/RR/NSEC.pm'} = 'stub';
...

I'm not sure what is the best way to make this maintainable in the future though.   The savings is pretty substantial however since there are a lots of dependency modules that no longer get uselessly loaded.

Comment 2 Justin Mason 2008-04-17 01:47:58 UTC
it might be worth taking it upstream to Net::DNS -- e.g. a parameter we can set in the Net::DNS namespace, $Net::DNS::SUPPORT_DNSSEC = 0.

they already lazy-load and conditionally evaluate code based on the presence of Net::DNS::SEC module -- adding a boolean check to that would be relatively easy.

BEGIN {

    $DNSSEC = eval {
            local $SIG{'__DIE__'} = 'DEFAULT';
            require Net::DNS::SEC;
            1
            } ? 1 : 0;


}


(note that since it's a BEGIN block we can't use the nicer "parameter to constructor" idiom without some heavier code changes there though.)

in my experience the Net::DNS maintainers have been quite good about responsiveness to patches....
Comment 3 Henrik Krohns 2019-06-24 15:17:09 UTC
Closing old stale bugs. This one looks very hacky and something upstream should do if needed.