delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/02/01/15:28:34

X-Spam-Check-By: sourceware.org
Subject: Shells hang during script execution
MIME-Version: 1.0
Date: Wed, 1 Feb 2006 15:27:43 -0500
Message-ID: <33E4EEC8BB80674C99E52A937E26DC6B043ACC@STEELPO.steeleye.com>
From: "Ernie Coskrey" <Ernie DOT Coskrey AT steeleye DOT com>
To: <cygwin AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k11KSWJO026664

I've run into problems with shell scripts hanging during execution for no apparent reason.  I've narrowed down my test case to two simple shell scripts.  To reproduce the problem, I ran three instances of the "top.sh" script included here, and after a bit (30 minutes to an hour or so) I'll see that one or two of the shells have just stopped in their tracks.

Here are the scripts:

----<top.sh>----
dir=$1
loops=$2

for loop in `seq 1 $loops`
do
        x=`./subtest.sh $dir`
        date
        echo loop $loop
done

----<subtest.sh>----
for j in `ls $1`
do
        if [ `echo $j | egrep -i "A|B" | wc -l` -ne 0 ]
        then
                echo $j
        fi
done
echo subtest1 done >&2

--------

I then ran three bash shells.  The commands I ran, simultaneously, were:

1) ./top.sh C:/ 600
2) ./top.sh C:/windows 300
3) ./top.sh C:/windows/system32 100

These ran for about 45 minutes, and then I noticed that two of them (1 and 2 above) had stopped printing any output.  The third was still moving along.  The third completed, but the first two never progressed any further.  I used Process Explorer from ntinternals.com, and saw that the two hung shells were not using any CPU, and did not have any child processes created; they were simply stopped.  If a process dump would be helpful, I can generate one with Windbg or gdb.


Here's my cygcheck output:

Cygwin Configuration Diagnostics
Current System Time: Wed Feb 01 15:07:43 2006

Windows 2003 Server Ver 5.2 Build 3790 Service Pack 1

Path:	C:\WINDOWS\system32
	C:\WINDOWS
	C:\WINDOWS\System32\Wbem
	C:\Program Files\Microsoft SQL Server\80\Tools\BINN
	C:\Program Files\SUperior SU

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 500(Administrator) GID: 513(None)
0(root)                 513(None)               544(Administrators)
545(Users)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 500(Administrator) GID: 513(None)
0(root)                 513(None)               544(Administrators)
545(Users)

SysDir: C:\WINDOWS\system32
WinDir: C:\Documents and Settings\Administrator\WINDOWS

Here's some environment variables that may affect cygwin:
PWD = '/usr/bin'
HOME = '/home/Administrator'

Here's the rest of your environment variables:
HOMEPATH = '\Documents and Settings\Administrator'
APPDATA = 'C:\Documents and Settings\Administrator\Application Data'
TERM = 'cygwin'
PROCESSOR_IDENTIFIER = 'x86 Family 15 Model 2 Stepping 7, GenuineIntel'
WINDIR = 'C:\WINDOWS'
TMPDIR = '/cygdrive/c/Documents and Settings/Administrator/Local Settings/Temp'
USERDOMAIN = 'EAGLE'
OS = 'Windows_NT'
ALLUSERSPROFILE = 'C:\Documents and Settings\All Users'
TEMP = '/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
USERNAME = 'Administrator'
CLUSTERLOG = 'C:\WINDOWS\Cluster\cluster.log'
PROCESSOR_LEVEL = '15'
FP_NO_HOST_CHECK = 'NO'
SYSTEMDRIVE = 'C:'
USERPROFILE = 'C:\Documents and Settings\Administrator'
LOGONSERVER = '\\EAGLE'
PROCESSOR_ARCHITECTURE = 'x86'
!C: = 'C:\cygwin\bin'
EXTMIRRBASE = 'C:\LKDR'
SHLVL = '1'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
HOMEDRIVE = 'C:'
PROMPT = '$P$G'
COMSPEC = 'C:\WINDOWS\system32\cmd.exe'
TMP = '/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp'
SYSTEMROOT = 'C:\WINDOWS'
PROCESSOR_REVISION = '0207'
PROGRAMFILES = 'C:\Program Files'
NUMBER_OF_PROCESSORS = '2'
SESSIONNAME = 'Console'
COMPUTERNAME = 'EAGLE'
!EXITCODE = '00000001'
_ = './cygcheck'
POSIXLY_CORRECT = '1'

Scanning registry for keys with 'Cygnus' in them...
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\SteelEye\LifeKeeper\Cygnus Solutions
HKEY_CURRENT_USER\Software\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\Program Options
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 = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = 'C:\cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = 'C:\cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = 'C:\cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = 0x0000000a
  native = 'C:\LK\cygwin'
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2\/bin
  (default) = 0x0000000a
  native = 'C:\LK\bin'
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = 0x0000000a
  native = 'C:\LK\bin'
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = 0x0000000a
  native = 'C:\LK\cygwin\lib'
HKEY_LOCAL_MACHINE\SOFTWARE\SteelEye\LifeKeeper\Cygnus Solutions\Cygwin\Program Options

Listing available drives...
Drv Type          Size   Used Flags              Name
a:  fd             N/A    N/A                    
c:  hd  NTFS      8189Mb  79% CP CS UN PA FC     
j:  cd             N/A    N/A                    
k:  hd             N/A    N/A                    
m:  hd             N/A    N/A                    
q:  hd             N/A    N/A                    
r:  hd             N/A    N/A                    
s:  hd             N/A    N/A                    
t:  hd             N/A    N/A                    
u:  hd             N/A    N/A                    
v:  hd             N/A    N/A                    
w:  hd             N/A    N/A                    
x:  hd             N/A    N/A                    
y:  hd             N/A    N/A                    
z:  hd             N/A    N/A                    

fd = floppy,          hd = hard drive,       cd = CD-ROM
net= Network Share,   ram= RAM drive,        unk= Unknown
CP = Case Preserving, CS = Case Sensitive,   UN = Unicode
PA = Persistent ACLS, FC = File Compression, VC = Volume Compression

Mount entries: these map POSIX directories to your NT drives.
-NT-           -POSIX-    -Type-  -Flags-
C:\cygwin      /          system  binmode
C:\cygwin/bin  /usr/bin   system  binmode
C:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  system  binmode,cygdrive

Looking to see where common programs can be found, if at all...
Not Found: awk
Not Found: bash
Not Found: cat
Not Found: cp
Not Found: cpp (good!)
Not Found: crontab
Not Found: find
Not Found: gcc
Not Found: gdb
Not Found: grep
Not Found: kill
Not Found: ld
Not Found: ls
Not Found: make
Not Found: mv
Not Found: patch
Not Found: perl
Not Found: rm
Not Found: sed
Not Found: ssh
Not Found: sh
Not Found: tar
Not Found: test
Not Found: vi
Not Found: vim

Looking for various Cygwin DLLs...  (-v gives version info)
   56k 2005/07/09 C:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz2-1.dll" v0.0 ts=2005/7/9 1:09
    7k 2005/11/20 C:\cygwin\bin\cygcharset-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygcharset-1.dll" v0.0 ts=2005/11/19 21:24
    7k 2003/10/19 C:\cygwin\bin\cygcrypt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypt-0.dll" v0.0 ts=2003/10/19 3:57
   40k 2005/09/29 C:\cygwin\bin\cygform-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygform-8.dll" v0.0 ts=2005/9/28 22:15
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 1:28
   35k 2002/01/09 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/9 1:03
   48k 2003/08/09 C:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
                  "cygform7.dll" v0.0 ts=2003/8/9 5:25
   28k 2003/07/20 C:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-3.dll" v0.0 ts=2003/7/20 3:58
   30k 2003/08/11 C:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-4.dll" v0.0 ts=2003/8/10 22:12
   19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/19 22:05
   15k 2003/07/20 C:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 4:00
   15k 2003/08/11 C:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-4.dll" v0.0 ts=2003/8/10 22:13
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 23:34
   29k 2003/08/10 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2003/8/10 19:16
   24k 2006/01/28 C:\cygwin\bin\cyghistory6.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory6.dll" v0.0 ts=2006/1/27 22:06
  947k 2005/11/20 C:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygiconv-2.dll" v0.0 ts=2005/11/19 21:24
   22k 2001/12/13 C:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 4:28
   37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-2.dll" v0.0 ts=2003/8/10 17:50
   31k 2005/11/20 C:\cygwin\bin\cygintl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-3.dll" v0.0 ts=2005/11/19 21:04
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 13:09
   21k 2005/09/29 C:\cygwin\bin\cygmenu-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu-8.dll" v0.0 ts=2005/9/28 22:15
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 1:27
   20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/9 1:03
   29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu7.dll" v0.0 ts=2003/8/9 5:25
   67k 2005/09/29 C:\cygwin\bin\cygncurses++-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++-8.dll" v0.0 ts=2005/9/28 22:16
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 1:29
  175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/9 1:03
  226k 2005/09/29 C:\cygwin\bin\cygncurses-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses-8.dll" v0.0 ts=2005/9/28 22:02
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 1:17
  202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/9 1:03
  224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses7.dll" v0.0 ts=2003/8/9 5:24
   11k 2005/09/29 C:\cygwin\bin\cygpanel-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel-8.dll" v0.0 ts=2005/9/28 22:15
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 1:27
   12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/9 1:03
   19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel7.dll" v0.0 ts=2003/8/9 5:24
  176k 2005/09/06 C:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre-0.dll" v0.0 ts=2005/9/6 16:49
  299k 2005/09/06 C:\cygwin\bin\cygpcrecpp-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcrecpp-0.dll" v0.0 ts=2005/9/6 17:26
    6k 2005/09/06 C:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix-0.dll" v0.0 ts=2005/9/6 17:26
   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpopt-0.dll" v0.0 ts=2002/6/9 1:45
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
  148k 2003/08/10 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2003/8/10 19:16
  152k 2006/01/28 C:\cygwin\bin\cygreadline6.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline6.dll" v0.0 ts=2006/1/27 22:06
   65k 2005/08/23 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2005/8/22 22:03
 1763k 2006/01/20 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2006/1/20 13:28
    Cygwin DLL version info:
        DLL version: 1.5.19
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 150
        Shared data: 4
        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: Fri Jan 20 13:28:43 EST 2006
        CVS tag: cr-0x5ef
        Shared id: cygwin1S4


Checking for any Cygwin services... 

Can't find the cygrunsrv utility, skipping services check.


Cygwin Package Information
Last downloaded files to: C:\cygwinpkg
Last downloaded files from: ftp://ftp.cise.ufl.edu/pub/mirrors/cygwin

Package              Version
_update-info-dir     00352-1
alternatives         1.3.20a-2
ash                  20040127-3
base-files           3.7-1
base-passwd          2.2-1
bash                 3.0-14
bzip2                1.0.3-1
coreutils            5.93-3
crypt                1.1-1
cygutils             1.2.9-1
cygwin               1.5.19-4
cygwin-doc           1.4-3
diffutils            2.8.7-1
editrights           1.01-1
findutils            4.2.27-1
gawk                 3.1.5-2
gdb                  20041228-3
gdbm                 1.8.3-7
grep                 2.5.1a-2
groff                1.18.1-2
gzip                 1.3.5-1
less                 381-1
libbz2_1             1.0.3-1
libcharset1          1.9.2-2
libgdbm              1.8.0-5
libgdbm-devel        1.8.3-7
libgdbm3             1.8.3-3
libgdbm4             1.8.3-7
libiconv             1.9.2-2
libiconv2            1.9.2-2
libintl              0.10.38-3
libintl1             0.10.40-1
libintl2             0.12.1-3
libintl3             0.14.5-1
libncurses5          5.2-1
libncurses6          5.2-8
libncurses7          5.3-4
libncurses8          5.4-4
libpcre0             6.3-1
libpopt0             1.6.4-4
libreadline4         4.1-2
libreadline5         4.3-5
libreadline6         5.1-2
login                1.9-7
man                  1.5p-1
mktemp               1.5-3
ncurses              5.4-4
pdksh                5.2.14-3
run                  1.1.6-1
sed                  4.1.4-1
tar                  1.15.1-3
tcltk                20030901-1
termcap              20050421-1
terminfo             5.4_20041009-1
texinfo              4.8-1
vim                  6.4-4
which                1.7-1
zlib                 1.2.3-1

Thanks for any help you can provide on this!

-----
Ernie Coskrey       SteelEye Technology, Inc.    803-461-3875

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