rsync-2.5.5 memory eater problem

Ruediger Oertel ro at suse.de
Wed Oct 9 08:04:01 EST 2002


Hi,

we ran into a little problem with rsync-2.5.5.

Setup: you run rsync-2.5.5 as normal rsync over ssh
(ie. not connecting to a rsync server). If you start
such a rsync but interrupt the pulling process with Ctrl-C,
the process on the other side may start to allocate all
memory on the remote machine.

As fa as we have analyzed the problem, the remote rsync
process wants to issue a error message that it could not
write 4096 bytes, receives a SIGPIPE and errno is set to EPIPE
in the fwrite call (line 279 in log.c). Then exit_cleanup is called
which in turn will call the same routine again and will of course
get EPIPE again and the loop continues (as long as we have memory
to recursivly call the same functions again and again).

As a quick workaround we have the following patch, since there is
no real point in trying to issue an error message if you have
already received EPIPE on write.

--- log.c
+++ log.c	2002/10/08 11:55:52
@@ -276,7 +276,7 @@

 	if (!f) exit_cleanup(RERR_MESSAGEIO);

-	if (fwrite(buf, len, 1, f) != 1) exit_cleanup(RERR_MESSAGEIO);
+	if (fwrite(buf, len, 1, f) != 1 && errno != EPIPE) exit_cleanup(RERR_MESSAGEIO);

 	if (buf[len-1] == '\r' || buf[len-1] == '\n') fflush(f);
 }

-- 
with kind regards (mit freundlichem Grinsen),
        Ruediger Oertel (ro at suse.de,bugfinder at t-online.de)
----------This machine does not crash randomly.-----------
   It only schedules a hangup when deemed appropriate.




More information about the rsync mailing list