public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* rsync local dir copy hang - solved for me
@ 2003-10-24  3:57 Bakken, Luke
  2003-10-24  4:18 ` Peter J. Stieber
  2003-10-24 12:29 ` Hannu E K Nevalainen
  0 siblings, 2 replies; 9+ messages in thread
From: Bakken, Luke @ 2003-10-24  3:57 UTC (permalink / raw)
  To: ML CygWIN

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

cygcheck -s output:

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Thu Oct 23 19:05:06 2003

Windows XP Professional Ver 5.1 Build 2600 Service Pack 1

Path:	C:\cyg\usr\local\bin
	C:\cyg\bin
	C:\cyg\bin
	C:\cyg\usr\X11R6\bin
	c:\VS\VSS\win32
	c:\ncftp
	d:\texmf\miktex\bin
	c:\gs\gs8.00\bin
	c:\gv\gsview
	c:\Perl\bin\
	c:\vim\vim62
	c:\usr\local\bin
	c:\WINDOWS\system32
	c:\WINDOWS
	c:\WINDOWS\System32\Wbem
	c:\scripts
	c:\Program Files\Starbase\StarGate SDK\Lib
	C:\cyg\home\lukeb\bin

Output from C:\cyg\bin\id.exe (nontsec)
UID: 1003(lukeb) GID: 513(None)
513(None)

Output from C:\cyg\bin\id.exe (ntsec)
UID: 1003(lukeb) GID: 513(None)
513(None)            544(Administrators)  
545(Users)

SysDir: C:\WINDOWS\System32
WinDir: C:\WINDOWS

CYGWIN = `tty binmode ntsec ntea'
HOME = `C:\cyg\home\lukeb'
MAKE_MODE = `unix'
USER = `lukeb'

Use `-r' to scan registry

a:  fd           N/A    N/A                    
c:  hd  NTFS   39997Mb  36% CP CS UN PA FC     
d:  hd  NTFS   36318Mb  25% CP CS UN PA FC     Local Disk
e:  cd           N/A    N/A                    
f:  cd           N/A    N/A                    

C:\cyg                          /                         system
binmode
c:                              /c                        system
binmode
d:                              /d                        system
binmode
C:\cyg/bin                      /usr/bin                  system
binmode
C:\cyg/lib                      /usr/lib                  system
binmode
C:\cyg\usr\X11R6\lib\X11\fonts  /usr/X11R6/lib/X11/fonts  system
binmode
.                               /mnt                      system
binmode,cygdrive

Found: C:\cyg\bin\awk.exe
Found: C:\cyg\bin\bash.exe
Found: C:\cyg\bin\cat.exe
Found: c:\usr\local\bin\cat.exe
Found: C:\cyg\bin\cp.exe
Found: c:\usr\local\bin\cp.exe
Found: C:\cyg\bin\cpp.exe
Found: C:\cyg\bin\find.exe
Found: c:\usr\local\bin\find.exe
Found: C:\cyg\bin\gcc.exe
Not Found: gdb
Found: C:\cyg\bin\grep.exe
Found: c:\usr\local\bin\grep.exe
Found: c:\scripts\grep.exe
Found: C:\cyg\bin\ld.exe
Found: c:\usr\local\bin\ld.exe
Found: C:\cyg\bin\ls.exe
Found: c:\usr\local\bin\ls.exe
Found: C:\cyg\bin\make.exe
Found: c:\usr\local\bin\make.exe
Found: C:\cyg\bin\mv.exe
Found: c:\usr\local\bin\mv.exe
Found: C:\cyg\bin\rm.exe
Found: c:\usr\local\bin\rm.exe
Found: C:\cyg\bin\sed.exe
Found: c:\usr\local\bin\sed.exe
Found: C:\cyg\bin\sh.exe
Found: c:\usr\local\bin\sh.exe
Found: C:\cyg\bin\tar.exe
Found: c:\usr\local\bin\tar.exe

   61k 2003/08/09 C:\cyg\bin\cygbz2-1.dll
  842k 2003/09/30 C:\cyg\bin\cygcrypto-0.9.7.dll
  645k 2003/04/11 C:\cyg\bin\cygcrypto.dll
   22k 2003/10/17 C:\cyg\bin\cygcygipc-2.dll
  380k 2002/07/24 C:\cyg\bin\cygdb-3.1.dll
  487k 2002/07/24 C:\cyg\bin\cygdb_cxx-3.1.dll
  132k 2003/07/12 C:\cyg\bin\cygexpat-0.dll
   45k 2001/04/25 C:\cyg\bin\cygform5.dll
   35k 2002/01/09 C:\cyg\bin\cygform6.dll
   48k 2003/08/09 C:\cyg\bin\cygform7.dll
   28k 2003/07/20 C:\cyg\bin\cyggdbm-3.dll
   30k 2003/08/11 C:\cyg\bin\cyggdbm-4.dll
   19k 2003/03/22 C:\cyg\bin\cyggdbm.dll
   15k 2003/07/20 C:\cyg\bin\cyggdbm_compat-3.dll
   15k 2003/08/11 C:\cyg\bin\cyggdbm_compat-4.dll
   69k 2003/08/10 C:\cyg\bin\cyggettextlib-0-12-1.dll
   12k 2003/08/10 C:\cyg\bin\cyggettextpo-0.dll
  134k 2003/08/10 C:\cyg\bin\cyggettextsrc-0-12-1.dll
   17k 2001/06/28 C:\cyg\bin\cyghistory4.dll
   29k 2003/08/10 C:\cyg\bin\cyghistory5.dll
  958k 2003/08/10 C:\cyg\bin\cygiconv-2.dll
   22k 2001/12/13 C:\cyg\bin\cygintl-1.dll
   37k 2003/08/10 C:\cyg\bin\cygintl-2.dll
   21k 2001/06/20 C:\cyg\bin\cygintl.dll
  119k 2002/02/09 C:\cyg\bin\cygjpeg6b.dll
   26k 2001/04/25 C:\cyg\bin\cygmenu5.dll
   20k 2002/01/09 C:\cyg\bin\cygmenu6.dll
   29k 2003/08/09 C:\cyg\bin\cygmenu7.dll
  156k 2001/04/25 C:\cyg\bin\cygncurses++5.dll
  175k 2002/01/09 C:\cyg\bin\cygncurses++6.dll
  226k 2001/04/25 C:\cyg\bin\cygncurses5.dll
  202k 2002/01/09 C:\cyg\bin\cygncurses6.dll
  224k 2003/08/09 C:\cyg\bin\cygncurses7.dll
   15k 2001/04/25 C:\cyg\bin\cygpanel5.dll
   12k 2002/01/09 C:\cyg\bin\cygpanel6.dll
   19k 2003/08/09 C:\cyg\bin\cygpanel7.dll
   67k 2003/09/10 C:\cyg\bin\cygpcre-0.dll
   63k 2003/04/11 C:\cyg\bin\cygpcre.dll
   15k 2003/09/10 C:\cyg\bin\cygpcreposix-0.dll
   61k 2003/04/11 C:\cyg\bin\cygpcreposix.dll
 1100k 2003/08/29 C:\cyg\bin\cygperl5_8_0.dll
  168k 2003/08/10 C:\cyg\bin\cygpng10.dll
  173k 2003/08/10 C:\cyg\bin\cygpng12.dll
   22k 2002/06/09 C:\cyg\bin\cygpopt-0.dll
  108k 2001/06/28 C:\cyg\bin\cygreadline4.dll
  148k 2003/08/10 C:\cyg\bin\cygreadline5.dll
  171k 2003/09/30 C:\cyg\bin\cygssl-0.9.7.dll
  165k 2003/04/11 C:\cyg\bin\cygssl.dll
  281k 2003/02/24 C:\cyg\bin\cygtiff3.dll
   60k 2003/08/09 C:\cyg\bin\cygz.dll
  949k 2003/09/20 C:\cyg\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.5.5
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 94
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Sat Sep 20 16:31:15 EDT 2003
        CVS tag: cr-0x9b
        Shared id: cygwin1S3


Cygwin Package Information
Package              Version            
_update-info-dir     00221-1            
ash                  20031007-1         
base-files           2.6-1              
base-passwd          1.1-1              
bash                 2.05b-16           
binutils             20030901-1         
bzip2                1.0.2-5            
clear                1.0-1              
cron                 3.0.1-11           
cygipc               2.02-1             
cygrunsrv            0.96-2             
cygutils             1.2.2-1            
cygwin               1.5.5-1            
cygwin-doc           1.3-6              
diffutils            2.8.4-1            
editrights           1.01-1             
enscript             1.6.3-3            
expat                1.95.6-2           
file                 4.03-2             
fileutils            4.1-2              
findutils            4.1.7-4            
gawk                 3.1.3-3            
gcc                  3.3.1-2            
gcc-mingw            20030911-3         
gdbm                 1.8.3-7            
gettext              0.12.1-3           
gnugo                3.4-1              
grep                 2.5-1              
groff                1.18.1-2           
gzip                 1.3.5-1            
inetutils            1.3.2-25           
less                 381-1              
libbz2_1             1.0.2-5            
libdb3.1             3.1.17-2           
libgdbm              1.8.0-5            
libgdbm-devel        1.8.3-7            
libgdbm3             1.8.3-3            
libgdbm4             1.8.3-7            
libgettextpo0        0.12.1-3           
libiconv2            1.9.1-3            
libintl              0.10.38-3          
libintl1             0.10.40-1          
libintl2             0.12.1-3           
libjpeg6b            6b-8               
libncurses5          5.2-1              
libncurses6          5.2-8              
libncurses7          5.3-4              
libpcre              4.1-1              
libpcre0             4.4-2              
libpng10             1.0.15-4           
libpng12             1.2.5-4            
libpopt0             1.6.4-4            
libreadline4         4.1-2              
libreadline5         4.3-5              
libtiff3             3.6.0-2            
links                0.96-1             
login                1.9-7              
lynx                 2.8.4-7            
make                 3.80-1             
man                  1.5j-2             
mingw-runtime        3.2-1              
mktemp               1.5-3              
ncftp                3.1.4-1            
ncurses              5.3-4              
netcat               1.10-2             
openssh              3.7.1p2-1          
openssl              0.9.7c-1           
openssl-devel        0.9.7c-1           
openssl096           0.9.6j-1           
patch                2.5.8-8            
pcre                 4.4-2              
pcre-doc             4.4-2              
pdksh                5.2.14-2           
perl                 5.8.0-5            
postgresql           7.3.4-2            
readline             4.3-5              
rsync                2.5.6-2            
rxvt                 2.7.10-3           
sed                  4.0.7-3            
sh-utils             2.0.15-4           
shutdown             1.4-1              
tar                  1.13.25-3          
termcap              20021106-2         
terminfo             5.3_20030726-1     
texinfo              4.2-4              
textutils            2.0.21-1           
unzip                5.50-5             
vim                  6.2.098-1          
w32api               2.4-1              
wget                 1.8.2-2            
which                1.5-2              
zip                  2.3-5              
zlib                 1.1.4-4            
Use -h to see help about each section

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

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <3F98FB3C.3050502@ntlworld.com>]
* RE: rsync local dir copy hang - solved for me
@ 2003-10-24 15:41 Bakken, Luke
  2003-10-25 14:49 ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Bakken, Luke @ 2003-10-24 15:41 UTC (permalink / raw)
  To: Hannu E K Nevalainen, ML CygWIN

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-10-28 14:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-24  3:57 rsync local dir copy hang - solved for me 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
     [not found] <3F98FB3C.3050502@ntlworld.com>
2003-10-24 15:25 ` Hannu E K Nevalainen
2003-10-24 15:41 Bakken, Luke
2003-10-25 14:49 ` Corinna Vinschen
2003-10-25 16:08   ` Hannu E K Nevalainen
2003-10-28 15:08   ` Mark Paulus

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