> [email protected] wrote:
> 
> I have encountered a sporadic bug which I believe is in ksh (not in my
> ksh scripts).  I'm trying to track this bug down so I can make a
> proper bug report.  I believe it's caused by using a construct like in
> a "filter" script:
> 
>      /bin/cat FILE | while read a b c ;do
>         blah && break
>         echo $a $b $c
>      done
> 
> What I see in the process list is that the cat is hung.  What I
> believe is happening is that some parent process which is reading the
> stdout of this process is somehow blocking, which is causing this
> process to block, which causes /bin/cat to block.  I can see in the
> lsof output that there is a single reader of the stdout of /bin/cat.

Does the hang still occur if you change the example to:
-- snip --
      while read a b c ;do
         blah && break
         echo $a $b $c
      done < FILE
-- snip --

> This is all complicated by several layers of dotted (sourced) scripts,
> which don't show up in the process list.  This bug does not occur in
> ksh88 running on AIX or Solaris, only in ksh93 running on Linux.  It
> doesn't always occur in the same place (the bottom level script is the
> same, but the caller can be different from occurance to occurance).
> Additionally, it occurs only sometimes when it is run, making me think
> it involves some kind or resource issue or race condition.
> 
> I have not yet had the chance of viewing this live while it's hung (it
> hangs in the middle of the night and it gets killed before I'm able to
> see what's going on).

Does Linux have some kind of equivalent for Solaris's /usr/bin/gcore to
get a core sample of the hanging process ?

[snip] 
> Any thoughts on how I can tell what's actually happening to cause this
> hang?  Or what would be useful for a bug report?  Any particular tools
> which are useful other than ps/lsof/strace/vim?

1. Can you please try to obtain stacktraces of the "cat" and the shell
process for both your script version and the "cat"-less version above,
please (at least on Solaris you could try to obtain stack traces via $
/usr/bin/pstack <pid> # or the "dbx"/"gdb" debuggers) ?
2. Which ksh93 version do you use, e.g what does $ print
"${.sh.version}" # say ?
3. In which locale does the script run, e.g. what does $ env | egrep
'^(LANG|LC_)' # say ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to