This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rsync windows -> unix still hanging :(


Mike -

Greger Cronquist and I have been using a patched rsync
successfully. This was patched from two published patches,
one for buffering which seems to cause severe performance
problems under cygwin while only mild under Linux. The
is for the hang documented elsewhere. Here are patch discussion links:
http://www.cygwin.com/ml/cygwin/2002-10/msg00308.html
http://sources.redhat.com/ml/cygwin/2002-09/msg01155.html

Below are the diffs. Note the use of 100ms not 30ms as per the
original posting.

Since you are on the rsync list, can you get them into that code line?

Jim

> On Sat, 28 Dec 2002, Scott Evans wrote:
>
> > I spent about 12 hours today writing a nice backup system based on
> > Mike Rubel's snapshot system; but much to my dismay, when I took it
> > for a test drive, I found that rsync hung on the first large directory
> > I tried to back up. Aiee!
> [ ... ]
>
> Hey Scott,
>
> I'm Mike Rubel (author of that snapshot system page)--I haven't heard
> about this cygwin issue before, but this would definitely be worth adding
> to the FAQ. I'm sorry to hear you're having so much trouble with it!
> You're actually the second person to mention windows issues; the other
> fellow was using a SAMBA mount and rsyncing locally on the server. The
> problem there was files mysteriously getting copied when they hadn't
> changed, or deleted when they weren't supposed to be. I asked the list if
> anyone else had seen that behavior, but no one responded, so I'm not sure
> what to think. I'll add it to the FAQ, anyway, and maybe the BUGS
> section.
>
> Please let me know if you find any additional information. I'm on the
> rsync list but not the cygwin list (yet).
>
> I've had no trouble with this at home with my roommate's Win2K PC, but
> between this case and the previous one, it sounds like the rsync/windows
> interaction may still have some rough edges, which is not really
> acceptable for a backup solution. :(
>
> Thanks,


Here are the patches/diffs against a freshly "cvs update"d rsync cvs tree:


Index: fileio.c
===================================================================
RCS file: /cvsroot/rsync/fileio.c,v
retrieving revision 1.5
diff -r1.5 fileio.c
79c79,107
< return write(f,buf,len);
---
> static char *writeBuf;
> static size_t writeBufSize;
> static size_t writeBufCnt;
>
> if ( !writeBuf ) {
> writeBufSize = MAX_MAP_SIZE;
> writeBufCnt = 0;
> writeBuf = (char*)malloc(MAX_MAP_SIZE);
> if (!writeBuf) out_of_memory("write_file");
> }
> ret = len;
> do {
> if ( buf && writeBufCnt < writeBufSize ) {
> size_t copyLen = len;
> if ( copyLen > writeBufSize - writeBufCnt ) {
> copyLen = writeBufSize - writeBufCnt;
> }
> memcpy(writeBuf + writeBufCnt, buf, copyLen);
> writeBufCnt += copyLen;
> buf += copyLen;
> len -= copyLen;
> }
> if ( !buf || writeBufCnt == writeBufSize ) {
> int thisRet = write(f, writeBuf, writeBufCnt);
> if ( thisRet < 0 ) return thisRet;
> writeBufCnt = 0;
> }
> } while ( buf && len > 0 );
> return ret;
Index: flist.c
===================================================================
RCS file: /cvsroot/rsync/flist.c,v
retrieving revision 1.127
diff -r1.127 flist.c
894c894
< io_start_buffering(f);
---
> io_start_buffering_out(f);
Index: io.c
===================================================================
RCS file: /cvsroot/rsync/io.c,v
retrieving revision 1.105
diff -r1.105 io.c
44,45c44,45
< static int multiplex_in_fd;
< static int multiplex_out_fd;
---
> static int multiplex_in_fd = -1;
> static int multiplex_out_fd = -1;
288a289,291
> static char *buffer;
> static size_t bufferIdx = 0;
> static size_t bufferSz;
290c293
< if (!io_multiplexing_in || fd != multiplex_in_fd)
---
> if (fd != multiplex_in_fd)
292a296,305
> if (!io_multiplexing_in && remaining == 0) {
> if (!buffer) {
> bufferSz = 2 * IO_BUFFER_SIZE;
> buffer = malloc(bufferSz);
> if (!buffer) out_of_memory("read_unbuffered");
> }
> remaining = read_timeout(fd, buffer, bufferSz);
> bufferIdx = 0;
> }
>
296c309,310
< read_loop(fd, buf, len);
---
> memcpy(buf, buffer + bufferIdx, len);
> bufferIdx += len;
299c313
< continue;
---
> break;
308c322,329
< if (tag == MPLEX_BASE)
---
> if (tag == MPLEX_BASE) {
> if (!buffer || remaining > bufferSz) {
> buffer = Realloc(buffer, remaining);
> if (!buffer) out_of_memory("read_unbuffered");
> bufferSz = remaining;
> }
> read_loop(fd, buffer, remaining);
> bufferIdx = 0;
309a331
> }
330c352,354
<
---
> if (remaining == 0) {
> io_flush();
> }
347,348d370
< io_flush();
<
534c556
< void io_start_buffering(int fd)
---
> void io_start_buffering_out(int fd)
542a565,569
> void io_start_buffering_in(int fd)
> {
> multiplex_in_fd = fd;
> }
>
729c756
< io_start_buffering(fd);
---
> io_start_buffering_out(fd);
Index: main.c
===================================================================
RCS file: /cvsroot/rsync/main.c,v
retrieving revision 1.156
diff -r1.156 main.c
348a349,350
> io_start_buffering_in(f_in);
> io_start_buffering_out(f_out);
424c426
< io_start_buffering(f_out);
---
> io_start_buffering_out(f_out);
437c439
<
---
> msleep(100);
478a481
> io_start_buffering_in(f_in);
571a575
> io_start_buffering_out(f_out);
580a585,586
> io_flush();
> io_start_buffering_out(f_out);
581a588
> io_flush();
592a600
> io_flush();
Index: proto.h
===================================================================
RCS file: /cvsroot/rsync/proto.h,v
retrieving revision 1.150
diff -r1.150 proto.h
105c105,106
< void io_start_buffering(int fd);
---
> void io_start_buffering_out(int fd);
> void io_start_buffering_in(int fd);
Index: receiver.c
===================================================================
RCS file: /cvsroot/rsync/receiver.c,v
retrieving revision 1.40
diff -r1.40 receiver.c
275a276,280
> /*
> * do a write flush
> */
> write_file(fd, NULL, 0);
>



--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]