Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Ralf Habacker" To: "cygwin" Subject: RE: Old Thread: Cygwin Performance Date: Sat, 26 Jan 2002 20:14:47 +0100 Message-ID: <000501c1a69d$b830b280$b66607d5@BRAMSCHE> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0006_01C1A6A6.19F51A80" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-Reply-To: <00b001c1a3df$3f676620$60a407d5@BRAMSCHE> Importance: Normal ------=_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 #include #include #include 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--