This is the mail archive of the cygwin-developers@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]

Current CVS repository: vfork/rsync still failing on NT4


I am still seeing rsync failing when started from ash, with the
current CVS repository (updated and compiled from scratch a couple of
hours ago) and the current ash release.

I saw a recent message from Christopher Faylor indicating that he
couldn't duplicate this problem, so I've spent some more time
attempting to boil it down to its most basic elements.  What I've
discovered is that ash uses vfork when running a command, whereas bash
uses fork, and that difference appears to be what's causing the
problem.

I managed to duplicate the problem without ash at all -- I can get it
to happen with a simple C program that vforks and then execs rsync in
the child process.  Alas, the problem does not occur when you run the
command under strace.

I've attached my test case program called "fork.c".  Compile it into
"fork.exe" and run "mkdir /tmp/foo/ /tmp/bar/ && ./fork.exe vfork
rsync /tmp/foo/ /tmp/bar/".  I *hope* rsync will then crash on you
(that is, I hope this enables you to duplicate the bug :-).

I've also attached two strace output files, one from running my sample
program as described above, and one from running it with the first
argument being "fork" instead of "vfork".  Although, as I said, the
problem doesn't occur under strace, note that there are differences in
the strace output in the two cases.  For example:

* In the vfork case, shortly after rsync starts up, it closes several
  file handles:

    115   12721 [main] rsync 112 dtable::vfork_child_fixup: here
    127   12848 [main] rsync 112 fhandler_base::close: handle 0x100
    134   12982 [main] rsync 112 fhandler_base::close: handle 0x1E0
    121   13103 [main] rsync 112 fhandler_base::close: handle 0x14C

  This doesn't happen in the fork case.

* The vfork case never calls sync_with_parent after the child rsync
  process is launched after the vfork.

I've also attached the gdb output from setting error_start and
catching the failure in the child rsync process.  It doesn't look
particularly useful to me, but perhaps someone else will be able to
derive something useful out of it.

Finally, I've attached cygcheck output.

I've spent some time looking at Cygwin source code trying to figure
out what's going wrong, to no avail.  Perhaps all of this will ring
bells in somebody else's mind.

Thanks!

  jik
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>

main(int argc, char *argv[])
{
  pid_t child_pid;
  char **base;
  int use_vfork = 0;

  if (argc < 3) {
    fprintf(stderr, "Not enough arguments\n");
    exit(1);
  }

  if (! strcmp(argv[1], "fork")) {
    use_vfork = 0;
  }
  else if (! strcmp(argv[1], "vfork")) {
    use_vfork = 1;
  }
  else {
    fprintf(stderr, "Must specify \"fork\" or \"vfork\"\n");
    exit(1);
  }

  if (use_vfork)
    child_pid = vfork();
  else
    child_pid = fork();

  if (child_pid < 0) {
    perror(use_vfork ? "vfork" : "fork");
    exit(1);
  }

  if (child_pid) {
    if (waitpid(child_pid, NULL, 0) < 0) {
      perror("waitpid");
      exit(1);
    }
  }
  else {
    execvp(argv[2], argv + 2);
    perror("execvp");
    exit(1);
  }
  
  exit(0);
}

strace.vfork.gz

strace.fork.gz

u:\jik\tmp>C:\cygwin\bin\gdb.exe -nw /usr/local/bin/rsync.exe 187
GNU gdb 5.0 (20010428-1)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...(no debugging symbols found)...
/u/jik/tmp/187: No such file or directory.
Attaching to program `/usr/local/bin/rsync.exe', process 187
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
gdb: unknown target exception 0xc0000096 at 0x61010000

Program received signal ?, Unknown signal.
[Switching to thread 187.0xb6]
(gdb) thread apply all where

Thread 2 (thread 187.0xb6):
#0  0x77f762e9 in ?? ()
#1  0x77f04ede in ?? ()

Thread 1 (thread 187.0xa7):
#0  0x61010000 in events_init ()
    at /u/jik/cygwin-cvs/src/winsup/cygwin/exceptions.cc:1116
Cannot access memory at address 0x3b005c
#0  0x77f762e9 in ?? ()
(gdb) 

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Sep  3 14:01:56 2001

WinNT Ver 4.0 build 1381 Service Pack 6

Path:	/bin
	/c/Program Files/Microsoft Visual Studio/Common/msdev98/BIN
	/c/Program Files/Microsoft Visual Studio/VC98/BIN
	/c/Program Files/Microsoft Visual Studio/Common/TOOLS
	/c/Program Files/Microsoft Visual Studio/Common/TOOLS/WINNT
	/usr/local/bin
	/bin
	/c/Program Files/Microsoft Visual Studio/Common/msdev98/BIN
	/c/Program Files/Microsoft Visual Studio/VC98/BIN
	/c/Program Files/Microsoft Visual Studio/Common/TOOLS
	/c/Program Files/Microsoft Visual Studio/Common/TOOLS/WINNT
	/usr/local/bin
	/usr/local/bin
	/usr/bin
	/bin
	/usr/bin
	/c/Perl/bin
	/c/WINNT/system32
	/c/WINNT
	/c/win32app/emacs-20.5
	/c/win32app/emacs-20.5/bin
	/c/NTReskit
	/c/WINNT/System32/WBEM

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

PWD = `/u/curlbot'
CYGWIN = `binmode tty nontsec error_start=u:\jik\tmp\gdbnw.bat'
USER = `curlbot'
MAKE_MODE = `unix'
HOME = `/u/curlbot'

NUMBER_OF_PROCESSORS = `2'
PROMPT = `$P$G'
LOGONSERVER = `\\NTCURLFS1'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
COMSPEC = `C:\WINNT\system32\cmd.exe'
!C: = `C:\cygwin\bin'
SYSTEMDRIVE = `C:'
HOSTNAME = `VANCOUVER'
PROCESSOR_REVISION = `0806'
INCLUDE = `\include\;C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\;\include\;C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\;'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
COMPUTERNAME = `VANCOUVER'
WINDIR = `C:\WINNT'
USERPROFILE = `C:\WINNT\Profiles\curlbot'
MSVCDir = `C:\Program Files\Microsoft Visual Studio\VC98'
PS1 = `\h\$ '
HOMESHARE = `\\terror\curlbot'
MSDevDir = `C:\Program Files\Microsoft Visual Studio\Common\msdev98'
MACHTYPE = `i686-pc-cygwin'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 8 Stepping 6, GenuineIntel'
OS = `Windows_NT'
P4CONFIG = `.p4conf'
OLDPWD = `/usr/bin'
MAIL = `/u/curlbot/Mailbox'
BASH_ENV = `.bashrc'
PROCESSOR_ARCHITECTURE = `x86'
TEMP = `/c/WINNT/Profiles/curlbot/LOCALS~1/Temp'
NTRESKIT = `C:\NTReskit'
PROCESSOR_LEVEL = `6'
SYSTEMROOT = `C:\WINNT'
HOMEDRIVE = `C:'
LIB = `\lib\;C:\Program Files\Microsoft Visual Studio\VC98\LIB\;C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\;\lib\;C:\Program Files\Microsoft Visual Studio\VC98\LIB\;C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\;'
SHLVL = `1'
HOMEPATH = `\'
USERDOMAIN = `CURL'
USERNAME = `curlbot'
SHELL = `/bin/bash'
HOSTTYPE = `i686'
OSTYPE = `cygwin'
TERM = `cygwin'
SMS_LOCAL_DIR = `C:\WINNT'
ESHELL = `bash.exe'
_ = `/bin/cygcheck'
TZ = `EST5EDT4,M4.1.0/2,M10.5.0/2'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\Cygnus Solutions
  (default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x0000002a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `c:\cygwin'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/c
  (default) = `c:'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/d
  (default) = `d:'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/m
  (default) = `m:'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/projects
  (default) = `p:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/software
  (default) = `s:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/t
  (default) = `t:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/u
  (default) = `u:'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `c:\cygwin\bin'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `c:\cygwin\lib'
  flags = 0x0000001a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  NTFS    7993Mb  48% CP CS UN PA FC     SYSTEM
d:  hd  NTFS    9326Mb  62% CP CS UN PA FC     
e:  cd           N/A    N/A                    
m:  net NTFS    1980Mb  10% CP CS    PA        curlbot
p:  net NTFS    1011Mb  13% CP CS    PA        projects
s:  net NTFS   17240Mb  99% CP CS    PA        software
t:  net NTFS   26693Mb  20% CP CS UN PA FC     
u:  net NTFS     159Mb  52% CP CS    PA        u

c:\cygwin\bin  /usr/bin  system  binmode,exec
c:\cygwin\lib  /usr/lib  system  binmode,exec
c:\cygwin  /        system  binmode,exec
c:    /c       system  binmode,exec
d:    /d       system  binmode,exec
m:    /m       system  binmode,exec
p:    /projects  system  binmode
s:    /software  system  binmode
t:    /t       system  binmode
u:    /u       system  binmode,exec

Found: c:\cygwin\bin\bash.exe
Found: c:\cygwin\bin\cat.exe
Found: c:\NTReskit\cat.exe
Warning: c:\cygwin\bin\cat.exe hides c:\NTReskit\cat.exe
Found: c:\cygwin\bin\cpp.exe
Found: c:\cygwin\bin\find.exe
Found: c:\cygwin\bin\gcc.exe
Found: c:\cygwin\bin\gdb.exe
Found: c:\cygwin\bin\ld.exe
Found: c:\cygwin\bin\ls.exe
Found: c:\NTReskit\ls.exe
Warning: c:\cygwin\bin\ls.exe hides c:\NTReskit\ls.exe
Found: c:\cygwin\bin\make.exe
Found: c:\cygwin\bin\sh.exe

   56k 2000/12/03 c:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2000/11/20 18:53
   82k 2001/01/21 c:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/1/21 15:39
   18k 2000/10/23 c:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2000/10/22 22:26
   17k 2001/01/07 c:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 23:34
   14k 2000/10/23 c:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2000/10/23 15:02
   81k 2001/04/28 c:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2001/4/28 18:57
   35k 2001/04/28 c:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2001/4/28 18:57
   45k 2000/10/22 c:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2000/10/22 19:06
  119k 2000/10/23 c:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2000/10/22 20:58
   53k 2001/01/21 c:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/1/21 15:39
  414k 2001/01/21 c:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/1/21 15:40
  299k 2001/01/21 c:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/1/21 15:38
   34k 2001/01/21 c:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/1/21 15:38
  162k 2000/10/23 c:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2000/10/22 20:40
  108k 2001/01/07 c:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
  390k 2001/04/28 c:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2001/4/28 18:56
    5k 2001/04/28 c:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2001/04/28 c:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2001/4/28 18:56
  243k 2000/10/23 c:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2000/10/22 21:14
  623k 2001/04/28 c:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2001/4/28 18:57
   41k 2000/11/20 c:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2000/11/19 21:41
   45k 2000/11/20 c:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2000/11/19 21:45
   49k 2000/10/23 c:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2000/10/22 20:22
 5190k 2001/09/03 c:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2001/9/3 11:35
    Cygwin DLL version info:
        dll major: 1003
        dll minor: 3
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 43
        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: Mon Sep 3 11:35:36 2001
        shared id: cygwin1S3-2001-09-03 11:35

Use -h to see help about each section

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