Mail Archives: cygwin/2002/01/26/14:17:39
------=_NextPart_000_0006_01C1A6A6.19F51A80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi all,
while makeing some tests I recognized, that sometime select() and close() crashes, if the number of used file
descriptors is > 60.
With a value >93 select() crashes.
With a value between 61 and 81 a close() call crashes instead of select(), but it seems that this is caused by the
previous select() call.
Appended is a little test app for error reproducing.
$ ./test 60
dup
select
close
close2
$ ./test 61
dup
select
close
Segmentation fault (core dumped)
$ ./test 62
dup
select
close
Segmentation fault (core dumped)
...
$ ./test 81
dup
select
close
Segmentation fault (core dumped)
$ ./test 82
dup
select
close
close2
.....
$ ./test 92
dup
select
close
close2
$ ./test 93
dup
select
Segmentation fault (core dumped)
The select() crashes in the cygwin1.dll in the method "select_stuff::~select_stuff" like shown in the strace
snippet below
4604 7210385 [main] lat_select 2308 set_bits: ready 1
4401 7214786 [main] lat_select 2308 set_bits: me 0xA011808, testing fd 7 (/tmp/t904.0)
4738 7219524 [main] lat_select 2308 set_bits: ready 1
4472 7223996 [main] lat_select 2308 set_bits: me 0xA0117D8, testing fd 6 (/tmp/t904.0)
4487 7228483 [main] lat_select 2308 set_bits: ready 1
4573 7233056 [main] lat_select 2308 set_bits: me 0xA0117A8, testing fd 5 (/tmp/t904.0)
4601 7237657 [main] lat_select 2308 set_bits: ready 1
4601 7242258 [main] lat_select 2308 set_bits: me 0xA011778, testing fd 4 (/tmp/t904.0)
4422 7246680 [main] lat_select 2308 set_bits: ready 1
4597 7251277 [main] lat_select 2308 select_stuff::poll: returning 75
4576 7255853 [main] lat_select 2308 select_stuff::cleanup: calling cleanup routines
4623 7260476 [main] lat_select 2308 select_stuff::~select_stuff: deleting select records
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14184 7274660 [main] lat_select 2308 handle_exceptions: In cygwin_except_handler exc 0xC0000005 at 0xB0 sp 0x22F91C
I hope this help to fix this bug
Ralf
------=_NextPart_000_0006_01C1A6A6.19F51A80
Content-Type: application/octet-stream;
name="test.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="test.c"
#include <sys/types.h>
#include <sys/time.h>
#include <sys/fcntl.h>
#include <stdio.h>
fd_set set;
void
doit(int n, fd_set *set)
{
fd_set nosave = *set;
static struct timeval tv;
select(n, 0, &nosave, 0, &tv);
}
main(int ac, char **av)
{
char c;
int n, N, nfds,fd, fid;
char fname[L_tmpnam];
// morefds();
N = 61;
fname[0] = 0;
nfds = 0;
FD_ZERO(&set);
/* Create a temporary file for clients to open */
tmpnam(fname);
fd = open(fname, O_RDWR|O_APPEND|O_CREAT, 0666);
unlink(fname);
if (ac == 2) N = atoi(av[1]);
printf("dup\n");
for (n = 0; n < N; n++) {
fid = dup(fd);
if (fid == -1) break;
if (fid >= nfds) nfds = fid + 1;
FD_SET(fid, &set);
}
// BENCH(doit(nfds,&set), 0);
printf("select\n");
doit(nfds,&set);
printf("close\n");
for (fid = 0; fid < nfds; fid++) {
if (FD_ISSET(fid, &set)) {
close(fid);
}
}
printf("close2\n");
close(fd);
exit(0);
}
------=_NextPart_000_0006_01C1A6A6.19F51A80
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_0006_01C1A6A6.19F51A80--
- Raw text -