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]

Problem with 20050106 snapshot


I'm having a problem with the 20050106 snapshot as well as my own
DLL build from CVS HEAD on 20050107. I've also seen these problems
in snapshots from late last year. I've just now isolated a small
test case.

The problem is with bash killing native processes. I have a bash
script that starts a native process in the background, installs a
signal handler for SIGINT, grabs the pid from the background
process, and then issues wait. The signal handler tries to kill the
pid that was captured.

With 1.5.12 and a DLL built from CVS on 11/19/2004, this works just
fine. With the latest snapshot, I often (but not always) get a "Bad
file descriptor" error from kill.

I've enclosed a C file with the source for a simple program that
sleeps for the time specified on the command-line. I compiled this
as a WIN32 application using

  % gcc -o sleepMingw -mno-cygwin sleepMingw.c

I've also enclosed the driver script sleepTest.sh.

Here's the output from one run:

+ ./sleepMingw 30
+ pid=4408
+ trap enTrapSIGINT 2
+ wait
++ enTrapSIGINT
++ echo 'killing process 4408'
killing process 4408
++ kill 4408
./sleepTest.sh: line 11: kill: (4408) - Bad file descriptor
++ exit

The processes end up as <defunct> in procps. Attempts to kill the
processes also result in the Bad file descriptor error.

cygcheck output is also attached. I should note that I'm running
this under WinXP SP2 with hyperthreading enabled. I can try
disabling hyperthreading if requested.

#include <unistd.h>

int main (int argc, char** argv)
{
    int sleepSecs = atoi(argv[1]);
    sleep(sleepSecs * 1000);
    exit(0);
}
#!/bin/bash

set -x

./sleepMingw $* &

enTrapSIGINT () { echo "killing process $pid"; kill $pid; exit; }

pid=$!
trap enTrapSIGINT 2
wait

Attachment: cygcheck.out
Description: Text document

-- 
David Rothenberger                spammer? -> spam@daveroth.dyndns.org
GPG/PGP: 0x7F67E734, C233 365A 25EF 2C5F C8E1 43DF B44F BA26 7F67 E734 


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