X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: RE: Getting 'Bad file descriptor' error with 1.5.24-2 Date: Tue, 6 Mar 2007 13:05:06 -0500 Message-ID: <8F37BF6F420455468C4BD57DD6BE199001F4F309@cobra.pc.cognex.com> In-Reply-To: <8F37BF6F420455468C4BD57DD6BE199001F4F2FD@cobra.pc.cognex.com> From: "Schuff, Scott" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l26I5ZjP014334 Okay, after a little investigation, I have a little more info. First, I think the 'Bad File Descriptor' errors are actually due to the hung process (sed, gawk, etc) being killed. It's hard to tell because the parent process doesn't flush its output buffer until after that, but I think it's probably from the parent process using an invalid process or pipe handle when the child is killed. So it's likely more symptom than cause. I've also discovered that the cygwin hangs only seem to happen often when the make is issued under perl. If I issue the exact same make from a bash prompt, it generally succeeds. I'm using the perl construct: open(CHILDOUT,"$cmd 2>&1 |"); while () { { print $fp ">>$_"; } to read the output of the make line by line, process it, and log it. This script has worked with a much older (circa 2002/2003) version of the cygwin tools. Has anyone else seen any problems like this? I tried both perl 5.6.1 and 5.8.8 and they both behave exactly the same way with the latest and previous version of the cygwin tools. For now I guess I'll just try piping the output to a file and reading the whole thing after make exits. Does anyone have any suggestions for futher debugging these hangs? Thanks for any help! -Scott -----Original Message----- From: Schuff, Scott Sent: Thursday, March 01, 2007 3:54 PM To: 'cygwin AT cygwin DOT com' Subject: Getting 'Bad file descriptor' error with 1.5.24-2 Hi all - I'm running a build of a fairly large/complex software project with Make, and at random points the whole thing will hang just after printing the error: /bin/sh: cannot duplicate fd 31 to fd 0: Bad file descriptor Sometimes the leaf process is sed, sometimes gawk, sometimes sh, but in all cases they are buried under a half dozen 'make's, and 'sh's. Does anyone have a suggestion on how to debug this? Is there any setting I can change in windows or Cygwin to avoid it? I have tried some things like increasing desktop heap, etc, but still see the problem. Thanks in advance for any help. -Scott -- 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/