You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Peter Samuelson <pe...@p12n.org> on 2009/03/24 11:47:42 UTC

Fwd: memleak in perl bindings (SVN::Client)

Hi,
I got this from a Debian user of the perl bindings in 1.5.1.  I haven't
yet tried to reproduce in newer code, but I understand the perl
bindings haven't changed all that much lately.

Is anyone equipped to look into this?  Thanks,
Peter


-- Martín Ferrar writes --

SVN::Client leaks so much memory, that it's not usable for any important
project. I'm attaching a test case that shows clearly the problem.

Steps to reproduce:

Save the attached script as "test"

$ svnadmin create /tmp/foo
$ svn import -m FOO test
file:///tmp/foo/test
Adding         test

Committed revision 1.
$ perl test
Reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20600  0.0  0.6  21380  6592 pts/7    S+   19:41   0:00 perl
test
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20600 42.0  5.2  73560 53528 pts/7    S+   19:41   0:00 perl
test
NOT reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20600 54.0  0.6  21524  6908 pts/7    S+   19:41   0:00 perl
test foo
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20600 94.0  2.2  41856 22608 pts/7    S+   19:41   0:01 perl
test foo

As you can see, while destroying the SVN object on each step alleviates
the problem, there's still a very noticeable increment in memory usage,
and a serious degradation in performance. If reusing the object, the
memory grows unbounded, today we almost killed alioth when running a
re-scan of the complete pkg-perl repository with the PET tool.

This run was testing the "ls" method. The "cat" method is much worse,
and dependent of the size of the object. Using the script source as
test:

$ perl test
Reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20871  0.0  0.6  21380  6592 pts/7    S+   19:48   0:00 perl
test
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20871 44.0  7.1 103520 73204 pts/7    S+   19:48   0:00 perl
test
NOT reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20871 56.0  0.6  21524  6920 pts/7    S+   19:48   0:00 perl
test foo
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20871 95.0  2.0  41960 21448 pts/7    R+   19:48   0:01 perl
test foo

Using a 100k file:

$ perl test
Reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20922  0.0  0.6  21380  6596 pts/7    S+   19:49   0:00 perl
test
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20922 68.0 21.3 266044 218972 pts/7   S+   19:49   0:01 perl
test
NOT reusing the SVN object
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20922 75.0  0.6  21524  6920 pts/7    S+   19:49   0:01 perl
test foo
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
martin   20922 92.5  7.8 106264 80696 pts/7    S+   19:49   0:03 perl
test foo

[...]

Versions of packages libsvn-perl depends on:
ii  libapr1                     1.2.12-5     The Apache Portable Runtime Librar
ii  libc6                       2.7-18       GNU C Library: Shared libraries
ii  libsvn1                     1.5.1dfsg1-2 Shared libraries used by Subversio
ii  perl                        5.10.0-19    Larry Wall's Practical Extraction 
ii  perl-base [perlapi-5.10.0]  5.10.0-19    minimal Perl system

[...]

#!/usr/bin/perl -w 

use SVN::Client;

$arg = shift;

if($arg) {
	warn "NOT reusing the SVN object\n";
	open FOO, "> /dev/null";

	my $ctx = new SVN::Client();
	system("ps u $$");
	foreach(1..500) {
		$ctx = new SVN::Client();
		#$ctx->ls('file:///tmp/foo', 'HEAD', 0);
		$ctx->cat (\*FOO, 'file:///tmp/foo/test', 'HEAD');
	}
	system("ps u $$");
} else {
	warn "Reusing the SVN object\n";
	open FOO, "> /dev/null";

	system("ps u $$");
	my $ctx = new SVN::Client();
	foreach(1..500) {
		#$ctx->ls('file:///tmp/foo', 'HEAD', 0);
		$ctx->cat (\*FOO, 'file:///tmp/foo/test', 'HEAD');
	}
	system("ps u $$");

	exec "perl $0 foo";
}


Bug#520963: Info received (Fwd: memleak in perl bindings (SVN::Client))

Posted by Debian Bug Tracking System <ow...@bugs.debian.org>.
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Peter Samuelson <pe...@p12n.org>

If you wish to submit further information on this problem, please
send it to 520963@bugs.debian.org, as before.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


-- 
520963: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520963
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems