This is the mail archive of the cygwin 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] |
Hi! When I use bash to build pipelines, they sometimes don't finish but instead some process remains running. Example: $ tail -f -n 10000 log.txt | grep . | head -n 2 Almost instantly I get the expected two lines of output, but no prompt back. I have to use ctrl-c. If I don't ctrl-c I can run pstree in another terminal and see this: $ pstree ?âââminttyâââbashâââtail ââminttyâââbashâââpstree Now, all of the above is of course rather silly, but there seems to be a few ingredients that are needed to trigger the bug. One is that there has to be at least three processes in the pipeline, the other that the pipeline should end not because the first process runs out of data but because the last process (or perhaps one in the middle) decides to end "prematurely". IIUC that should cascade a SIGPIPE signal to the other involved processes, but that does not seem to happen? Note that this has little to do with the programs tail, grep and head used in my example, it is possible to construct other pipelines that behave similarly and I originally detected the problem with small private tools of my own writing. What I do as a workaround in my programs is that they exit on errors when writing to stdout. But again, IIUC that should not be needed. It also seems to depend on the content of log.txt, so I have uploaded a log.txt that I can trigger the problem with every time [1]. Or are my expectations all wrong? Cygcheck output attached. And for the record, it also reproduces with the latest snapshot, i.e.: $ uname -a CYGWIN_NT-6.1-WOW64 peda-pc 1.7.10s(0.251/5/3) 20110829 15:53:50 i686 Cygwin Cheers, Peter [1] http://www.lysator.liu.se/~peda/log.txt
Attachment:
cygcheck.out
Description: Text document
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |