public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Bakken, Luke" <Luke.Bakken@getronics.com>
To: "Hannu E K Nevalainen" <garbage_collector@telia.com>,
	"ML CygWIN" <cygwin@cygwin.com>
Subject: RE: rsync local dir copy hang - solved for me
Date: Fri, 24 Oct 2003 15:41:00 -0000	[thread overview]
Message-ID: <407DF7D68DD30440B5CEB70ED234D1CF03F871F6@excuswa100.americas.unity> (raw)

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

Yep.
 
>  Thus I'm assuming it doesn't block and that msleep() is 
> something internal
> to rsync, using usleep() or some such.

It uses select(). When I used strace on a non-modified version of rsync
to watch where it hung, here's the last bit of output I saw:

   18 9449430 [main] rsync 3260 stopped_or_terminated: considering pid
3276
   18 9449448 [main] rsync 3260 checkstate: returning -1
   18 9449466 [main] rsync 3260 proc_subproc: waiting thread found no
children
   20 9449486 [main] rsync 3260 proc_subproc: finished processing
terminated/stopped child
   18 9449504 [main] rsync 3260 proc_subproc: returning 1
   21 9449525 [main] rsync 3260 wait4: 0 = WaitForSingleObject (...)
   19 9449544 [main] rsync 3260 wait4: intpid 3276, status 0x22FE28,
w->status 0, options 1, res 0
   20 9449564 [main] rsync 3260 cygwin_select: 0, 0x0, 0x0, 0x0,
0x22FDC0
   19 9449583 [main] rsync 3260 cygwin_select: to->tv_sec 0, to->tv_usec
20000, ms 20
   18 9449601 [main] rsync 3260 cygwin_select: sel.always_ready 0

It never got past cygwin_select().

> of the patch is
> called "busy waiting" and is a *hard* blow against all other 
> software that
> is running at the same time.

But, it's OK for me because a) It fixes the problem b) It doesn't wait
long at all c) It doesn't appear to tie up resources.

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

Nope, I haven't seen any of this. It could happen, I'm sure.

> The bottom point: *don't do that* ;-)
>  i.e. leave the msleep() call there.

If I leave msleep there, it hangs every time. So I'm taking it out. Now,
this fixes one hang at one time, but not others. For instance, if there
is nothing to do since the sources and targets are in sync, it'll hang.
If the source dir doesn't exist, it still hangs. I'm now going to see if
I can isolate the heart of the problem with a simple program that forks
and sleeps in the same fashion as with rsync.

Luke

--
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/

             reply	other threads:[~2003-10-24 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-24 15:41 Bakken, Luke [this message]
2003-10-25 14:49 ` Corinna Vinschen
2003-10-25 16:08   ` Hannu E K Nevalainen
2003-10-28 15:08   ` Mark Paulus
     [not found] <3F98FB3C.3050502@ntlworld.com>
2003-10-24 15:25 ` Hannu E K Nevalainen
  -- strict thread matches above, loose matches on Subject: below --
2003-10-24  3:57 Bakken, Luke
2003-10-24  4:18 ` Peter J. Stieber
2003-10-24  4:46   ` Larry Hall
2003-10-24 12:29 ` Hannu E K Nevalainen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=407DF7D68DD30440B5CEB70ED234D1CF03F871F6@excuswa100.americas.unity \
    --to=luke.bakken@getronics.com \
    --cc=cygwin@cygwin.com \
    --cc=garbage_collector@telia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).