Subject: | SSLGlue:FTP - Memory leak in starttls() |
Date: | Thu, 15 Oct 2015 16:35:29 -0700 |
To: | bug-Net-SSLGlue [...] rt.cpan.org |
From: | Ramachandra Kasyap <kasyap.mr [...] gmail.com> |
Code to reproduce (I was using '$ftp->login' and 'ftp->ls' as well, but the
memory leak is seen even without those):
#!/usr/bin/perl -w
use strict;
require Net::SSLGlue::FTP;
sub ftp
{
my $ftp;
$ftp = Net::FTP->new($_[0],PeerPort =>$_[1], Timeout=>$_[3] ) or
return (1,"Failed to connect - $!");
$ftp->starttls(SSL_verify_mode=>0);
$ftp->stoptls();
$ftp->quit;
}
while (1)
{
sleep (2);
ftp("192.168.1.1",21,"filename",2,1);
}
Start this script replacing the IP. Memory usage of the perl process keeps
increasing. From my basic debugging, I see there is a leak as immediately
after configure_SSL() is called from start_SSL() in SSL.pm (specifically
after the following assignment - '${*$self}{'_SSL_ctx'} = $ctx;'_. Browsing
the internet, I gathered that this may happen due to circular references,
but haven't been able to determine if that is the case. Also tried using
Devel::Leak and I do see the 'count' going up, but could not make much
progress about where the error is.
SSLGlue Version: 1.54
IO-Socket-SSL version: 2.016
Perl version: 5.14.2
OS: Freebsd 8.4-RELEASE
Thanks & Regards,
Kasyap