This is the mail archive of the cygwin@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]
Other format: [Raw text]

Re: tee core dumped


On Wed, 27 Aug 2003, Philippe Torche wrote:

> I found a problem with tee (probably), please try this sample code
> below. I've found the same problem with other tools like gawk, ...
>
> echo '#!/usr/bin/bash
> sleep 10 > /dev/null 2>&1 &
> transfert_job=$!
>
> echo LINENO=$LINENO
> procps -p $transfert_job -o 'pid,ppid'
> echo LINENO=$LINENO
> ' > test.sh
> chmod +x test.sh
> # OK
> test.sh > test.out
> # KO KO KO KO KO KO KO KO KO KO KO KO KO KO
> test.sh | tee test.out
> # Segmentation fault (core dumped)
>
> Info:
> ----
>
> ========================================
> $ cat tee.exe.stackdump
> Exception: STATUS_ACCESS_VIOLATION at eip=610BA041
> eax=00000000 ebx=615F1F50 ecx=FFFFFFFF edx=6F6C5C72 esi=0076FE9C
> edi=6F6C5C72
> ebp=0076FE74 esp=0076FE70 program=C:\cygwin\bin\tee.exe
> cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
> Stack trace:
> Frame     Function  Args
> 0076FE74  610BA041  (6F6C5C72, 0076FEA0, 00000004, 0076FE9C)
> 0076FEB4  6105828B  (00A20000, 00000000, 00000000, FFFFFFFF)
> 0076FF04  61077738  (FFFFFFFE, 00000010, 00000000, 00000000)
> 0076FF84  61077CC8  (610D1B58, 00000000, 858A88E0, 804FAB78)
> 0076FFB4  610053C8  (610D1B58, 00000000, 0022FC44, 610D1B58)
>       3 [sig] tee 2400 handle_exceptions: Error while dumping state
> (probably corrupted stack)
>
> ========================================
> $ /usr/bin/tee --version
> tee (sh-utils) 2.0.15
> Written by Mike Parker, Richard M. Stallman, and David MacKenzie.
>
> ========================================
> $ cygcheck -svr
> [snip]

Philippe,

Lack of responses doesn't necessarily indicate that your post wasn't seen
(or your problem reproduced), but more likely lack of time for debugging
the problem (see <http://www.catb.org/~esr/faqs/smart-questions.html>).

FWIW, I was able to reproduce your problem (in fact, simply calling
"/bin/procps -p $$ -o 'pid,ppid' | tee test.out" was enough to trigger the
problem). At the moment, I don't have an unstripped version of the DLL
installed on my system, so I couldn't do the debugging necessary for this.
>From the range of addresses in the stack trace, it seems to happen
somewhere in the Cygwin DLL itself.  I've compared the strace for the
problematic command with the one from simply doing "echo | tee test.out".
The difference in straces is not significant (to me), except that readv()
seems to never get to the end of fhandler_base::read().  I'm attaching the
relevant chunk of the diffs (with times and PIDs stripped out to minimize
noise) in the hopes that this helps someone else debug this.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Attachment: tee.strace.diff
Description: Text document

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

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