Joe Davis <m...@jo.ie> wrote:

> By the looks of it, openrsync does attempt to map the entire file, from
> usr.bin/rsync/uploader.c:
> 
>     mapsz = st.st_size;
>     map = mmap(NULL, mapsz, PROT_READ, MAP_SHARED, *fileinfd, 0);
> 
> The likely reason for your out of memory error is the default datasize
> in login.conf. IIRC on some arches it's set to 768MB by default, which
> would allow your 300MB file to transfer, but would cause mmap to fail
> upon attempting to map the 1.6GB one.
> 
> Increasing the default limits in /etc/login.conf should fix the problem.
> 
> Note that rsync (not openrsync), doesn't use mmap for other reasons,
> from rsync-3.1.3/fileio.c:
> 
> /* This provides functionality somewhat similar to mmap() but using read().
>  * It gives sliding window access to a file.  mmap() is not used because of
>  * the possibility of another program (such as a mailer) truncating the
>  * file thus giving us a SIGBUS. */

It should be rewritten to not use mmap.  mmap is not needed in this case,
since it is a network speaker.  Meanwhile, fallback code isn't present.
Pretty ridiculous..

Reply via email to