This is the mail archive of the 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 local dir copy hang - solved for me

> From: Bakken, Luke
> Sent: Friday, October 24, 2003 4:19 AM

> Hi all,
> I was attempting to use rsync (v 2.5.6) to copy one local directory to
> another on my machine (Windows XP) today when I experienced the dreaded
> hang. It copied the files, and hung waiting for a child process to exit.
> When I killed that process using taskmgr, the parent exited OK.
> The following fixed my particular hang situation:
> --- orig_main.c 2003-10-23 19:16:22.500000000 -0700
> +++ main.c      2003-10-23 19:16:35.828125000 -0700
> @@ -47,7 +47,7 @@
>         int cnt;
>         while ((waited_pid = waitpid(pid, status, WNOHANG)) == 0) {
> -               msleep(20);
> +               /* msleep(20); */
>                 io_flush();
>         }
> I hope this can be of help to someone!
> Luke

Now the following text isn't meant to be rude or some such, so please don't
take offence. This is just yet another of those itchy little points of

$ man waitpid
No manual entry for waitpid
$ man msleep
No manual entry for msleep

Hmm? Is waitpid() a blocking call or not? WRT "WNOHANG" it looks like an
unblocking one...

 Thus I'm assuming it doesn't block and that msleep() is something internal
to rsync, using usleep() or some such.
 If msleep() does more than so, I would guess the problem to be inside

 A general comment: Given what I've written above the result of the patch is
called "busy waiting" and is a *hard* blow against all other software that
is running at the same time.
 If the loop exit condition appears "late" the machine running the above
code will experience jerkyness and other ill effects - at the extreme but
still likely level there might even be disturbances of *vital* system
functions (e.g. related to time critical tasks).

The bottom point: *don't do that* ;-)
 i.e. leave the msleep() call there. This is a simple - yet effective - way
to avoid ill effects of a tight loop.

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf("Timezone: %s\n", (DST)?"UTC+02":"UTC+01"); --

 I have a cheap SCSI-interface in my PC, this is connected to my scanner;
now can you guess what happens when I start scanning?
 Not very hard, ehh? Yes indeed, the entire computer stops, waiting for SCSI
I/O; i.e. 10-20 seconds for a preview, 30-60 seconds for scanning the bus at
boot time, anything from a minute and up for scanning an image.
 Guess what? I *do* disable this piece of hardware when I'm not going to use
it explicitly. (Monetary reasons leaves me in this situation) :-7


Unsubscribe info:
Problem reports:

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