delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/24/05:29:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Hannu E K Nevalainen" <garbage_collector AT telia DOT com>
To: "ML CygWIN" <cygwin AT cygwin DOT com>
Subject: RE: rsync local dir copy hang - solved for me
Date: Fri, 24 Oct 2003 11:28:38 +0200
Message-ID: <NGBBLLIAMFLGJEOAJCCEKELLDFAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
In-reply-to: <407DF7D68DD30440B5CEB70ED234D1CF03F8717D@excuswa100.americas.unity>
Importance: Normal

> 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
mine...


$ 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
msleep().

 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"); --


Example:
 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

--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019