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

Re: svn client fails with Berkeley DB error Cannot allocate memory - repository broken

From: Ben Reser <ben_at_reser.org>
Date: 2004-07-03 02:02:33 CEST

On Thu, Jun 03, 2004 at 06:42:50PM +0100, Martin J. Evans wrote:
> Hi subversion developers,
>
> I've posted this problem to the users list and although I've had some
> suggestions I am stuck with what looks like a serious bug in subversion.
>
> The basic problem I'm seeing is I have a small perl script which when run using
> a HTTP (remotely) or FILE (locally) URL returns:
>
> Berkeley DB error while opening 'transactions' table for filesystem
> /var/subversion/distribution/linux-x86/db:
> Cannot allocate memory
>
> and the repository is then broken. I am using subversion 1.0.2 and cannot
> upgrade currently but others in the users list seem to see a similar problem
> with 1.0.4. I can reproduce at will. I have tried doubling the lock values in
> DB_CONFIG - it made no difference. The machine subversion is running on is
> Linux with kernel 2.4.23, dual Xeon 2.4GHz and 2Gb of memory. subversion was
> compiled with gcc 2.95.3 and uses glibc 2.2.4 and BDB 4.2.52.
>
> I can replicate the problem at will now by doing this:
>
> 1. get hold of subversion sources
> cd /tmp
> svn co http://svn.collab.net/repos/svn/trunk subversion
> cd subversion
> find . -name .svn -exec rm -fr {} \;
>
> 2. create test repository
> cd dir where repositories create (/var/subversion/distribution for me).
> svnadmin create test-martin
>
> 3. import subversion tree into test repository.
> cd /tmp/subversion
> svn import . file:///var/subversion/distribution/test-martin -m "test"
>
> 4. prove the db is OK
>
> cd /var/subversion/distribution
> svnadmin recover test-martin
>
> sh-2.05$ svnadmin recover test-martin/
> Please wait; recovering the repository may take some time...
>
> Recovery completed.
> The latest repos revision is 1.
>
> 5. run the attached perl program with:
>
> /tmp/x.pl -u file:///var/subversion/distribution/test-martin
>
> Couldn't open a repository: Unable to open an ra_local session to URL: Unable
> to open repository
> 'file:///var/subversion/distribution/test-martin/doc/book/README': Berkeley DB
> error while opening 'uuids' table for filesystem
> /var/subversion/distribution/test-martin/db:
> Cannot allocate memory at /tmp/x.pl line 17

I get a slightly different error:
Couldn't open a repository: Unable to open an ra_local session to URL:
Unable to open repository
'file:///home/breser/mje-test/test-martin/contrib/client-side': Berkeley
DB error while opening 'revisions' table for filesystem
/home/breser/mje-test/test-martin/db:
Cannot allocate memory at x.pl line 15

You'll note that my error is opening revisions, not uuids. Also I'm
using bdb 4.1 not 4.2.

But...

> 6. demonstrate DB is now broken and unrecoverable
>
> cd /var/subversion/distribution
> svnadmin recover test-martin
>
> sh-2.05$ svnadmin recover test-martin
> Please wait; recovering the repository may take some time...
> svn: DB_RUNRECOVERY: Fatal error, run database recovery

My repostiory doesn't get broken, nor do I have any problem running
recover. I can run that script forever without any problems.

Might be worthwhile to write a small client that does the same thing in
C and statically link and run gdb over it...

> I have never managed to recover a repository broken in this way but am
> open to suggestions. All the arguments for changing the attached perl
> script to make it succeed are irrelevant to me - I can make the script
> work fine via http by reducing the number of max_client in apache or
> by introducing sleeps into it (speed was never important for it). The
> error appears to happen at the server end and it leaves my repository
> broken.

Agred, this is either a bug in bdb or a bug in the way we're using it.
Either way it may very well depend upon during what operation you run
out of memory, which may make it difficult for us to reproduce.

> What I particularly don't like about it is that I can make this happen
> using a http URL which implies to me I could break other public
> repositories and they could break my public repositories. Needless to
> say I've not tried this.

Based on my testing it may or may not happen on a server. If you can
write a program to the C API that produces the same problem I'd be very
interested in the code path it's taking...

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 3 02:03:59 2004

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