out of memory in receive_file_entry rsync-2.6.2

James Bagley Jr jabagley at cvs.agilent.com
Tue Aug 10 18:36:26 GMT 2004


I've had some problems using rsync to transfer directories with more than
3 million files.  Here's the error message from rsync:

ERROR: out of memory in receive_file_entry
rsync error: error allocating core memory buffers (code 22) at util.c(116)
rsync: connection unexpectedly closed (63453387 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(342)

I'm doing a pull on a linux system fom the HP-UX system that actually
houses the data.  Both using rsync-2.6.2.  The one solution i've come up
with isn't pretty, but seems to work.

Basically, I wrote a shell function that runs an rsync process for each
subdirectory if necessary.  I'm using "find | wc -l" to count the number
of files in the source path and then calling the function again for each
subdirectory if the number is more than 2mil.  Perhaps recursion is a bad
idea?  It's the only way I could think of to catch the case where all the
files exist in a single directory several levels below the top.  Anyways,
i'll take the function out of my script and paste it here but it may not
work right taken out of context.  YMMV.

function DC {
        # "Divide and Conquer"
        #  evil hack to get around rsync's 3mil file limit

        # Accepts two arguments as the srcpath and dstpath.  Will not work
	# if srcpath is local.

        srchost=`echo $1 | awk -F: '{ print $1 }'`
        srcdir=`echo $1 | awk -F: '{ print $2 }'`

        num_files=`ssh root@$srchost "find $srcdir | wc -l"`

        if [ $((num_files)) -gt 2000000 ]
                echo "WARNING!  file count greater than 2mil, recursing into subdirs."

                for file in `ssh root@$srchost "ls $srcdir"`
                        dstpath=`echo $2/$file`

                        DC $1/$file $dstpath
                rsync $rsync_opts $1 $2

Comments?  Better ideas?

James Bagley			|           CDI Innovantage
jabagley at cvs.agilent.com	| Technical Computing UNIX Admin Support
   DON'T PANIC			|       Agilent Technologies IT

More information about the rsync mailing list