Net::Fastly leaks 8-16kB of memory each time we execute a purge request. _get() requests are also affected. The leak is happening in Net/Fastly/Client.pm, line 318, in Net::Fastly::UA::request ( where it calls out to $self->SUPER::request($req); ). This appears to be an issue in LWP related to https and certain certificates.
It is affecting my employer in production, so I was hopeful something could be done - maybe the certificate could be tweaked, or libcurl could be used instead of LWP, or a separate web server could be set up that has a certificate LWP likes? Details showing the leak are below.
I have also filed a ticket upstream with the LWP maintainer as well - https://rt.cpan.org/Ticket/Display.html?id=88287#txn-1568772
Thanks,
Brian Szymanski
$ perl -e 'use strict; use warnings; use Net::Fastly::Client; my $client = Net::Fastly::Client->new( api_key => [REDACTED] ); for (0..499) { $client->_get( "/foo" ); } ' & sleep 2 ; ps auxww | grep Net::Fastly | grep -v grep ; sleep 15 ; ps auxww | grep Net::Fastly | grep -v grep ; kill %1 ; sleep 1
[1] 28833
2104 28833 78.5 0.4 207592 32908 pts/1 S 21:53 0:01 perl -e use strict; use warnings; use Net::Fastly::Client; my $client = Net::Fastly::Client->new( api_key => [REDACTED] ); for (0..499) { $client->_get( "/foo" ); }
2104 28833 35.7 0.4 208500 33784 pts/1 S 21:53 0:06 perl -e use strict; use warnings; use Net::Fastly::Client; my $client = Net::Fastly::Client->new( api_key => [REDACTED] ); for (0..499) { $client->_get( "/foo" ); }
[1]+ Terminated perl -e 'use strict; use warnings; use Net::Fastly::Client; my $client = Net::Fastly::Client->new( [REDACTED] ); for (0..499) { $client->_get( "/foo" ); } '
$