[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Memory leak in svn_ra_get_file() with svn+ssh://?

From: Philipp Marek <philipp_at_marek.priv.at>
Date: 2007-10-02 14:29:10 CEST

Hello everybody,

I think there's a memory leak in svn_ra_get_file() or the svn+ssh RA layer.
FSVS (http://fsvs.tigris.org) uses svn_ra_get_file() eg. for reverts -
to fetch a clean copy of a file from the repository.

While it behaves for file://-URLs (memory usage constant), it grows
for svn+ssh://-accesses; when fetching a 100MB random-bytes file,
it takes 294MB more memory to finish that operation.

I've got a (partly useful) callstack:

#0 0x00002afb38d69cd0 in malloc () from /lib/libc.so.6
#1 0x00002afb391834dc in apr_palloc () from /usr/lib/libapr-1.so.0
#2 0x00002afb38387ea6 in svn_stringbuf_ensure () from /usr/lib/libsvn_subr-1.so.1
#3 0x00002afb38387f32 in svn_stringbuf_appendbytes () from /usr/lib/libsvn_subr-1.so.1
#4 0x00002afb3a21258f in ?? () from /usr/lib/libsvn_ra_svn-1.so.1
#5 0x00002afb3a21264d in svn_ra_svn_read_item () from /usr/lib/libsvn_ra_svn-1.so.1
#6 0x00002afb3a20bacc in ?? () from /usr/lib/libsvn_ra_svn-1.so.1
#7 0x0000000000413ac7 in rev__get_file (sts=0x63baf0, revision=10, fetched=0x7fff7295ec08, only_tmp=0x0, pool=<value optimized out>) at revert.c:275
... and so on up to main.

The last line (revert.c:275) is where svn_ra_get_file() gets called.
I have to admit that the stream is not a simple svn_stream_from_aprfile(),
but has a layer for blockwise MD5-hashing plugged in the middle; but
that should be the same for file:/// and svn+ssh:///.

From the above dump it seems that the data gets collected into
a svn_stringbuf_t; does somebody know why?

It is reproduceable with subversion as well; see here:
        flip@heim:/tmp$ svnadmin create repo
        flip_at_heim:/tmp$ svn co file:///tmp/repo wc
        Ausgecheckt, Revision 0.
        flip@heim:/tmp$ cd wc
        flip@heim:/tmp/wc$ openssl rand 100000000 > file
        flip@heim:/tmp/wc$ svn add file
        A (bin) file
        flip@heim:/tmp/wc$ svn ci file -m1
        Hinzuf. (bin) file
        ├ťbertrage Daten .
        Revision 1 ├╝bertragen.
        flip_at_heim:/tmp/wc$ svn cat svn+ssh://localhost/tmp/repo/file > /dev/null

Parallel looking at the top output starts with
        27871 flip 18 0 86976 3848 2632 D 7.9 0.4 0:00.08 svnserve
        27866 flip 18 0 114m 17m 2948 D 4.9 1.9 0:00.05 svn
and near the end I get
        27871 flip 16 0 87128 4024 2632 S 7.9 0.4 0:01.11 svnserve
        27866 flip 15 0 387m 290m 2952 S 4.9 30.8 0:01.37 svn

This is debian subversion=1.4.4dfsg1-1, libsvn1=1.4.4dfsg1-1, on a
x86-64 installation.

Furthermore my logging functions tell me that the blocks that are being
passed through are only 4kB; is there an easy way to increase that size?
For file:// there are 16kB blocks; that is better, but I'd like to use
128kB or something in that size.

Any help or ideas?
Thank you very much in advance.



Versioning your /etc, /home or even your whole installation?
             Try fsvs (fsvs.tigris.org)!
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 2 14:29:25 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.