public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Ralf Habacker" <Ralf.Habacker@freenet.de>
To: "cygwin" <cygwin@cygwin.com>
Subject: RE: Old Thread: Cygwin Performance
Date: Sat, 26 Jan 2002 11:29:00 -0000	[thread overview]
Message-ID: <000501c1a69d$b830b280$b66607d5@BRAMSCHE> (raw)
In-Reply-To: <00b001c1a3df$3f676620$60a407d5@BRAMSCHE>

[-- Attachment #1: Type: text/plain, Size: 1984 bytes --]

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


[-- Attachment #2: test.c --]
[-- Type: application/octet-stream, Size: 901 bytes --]

#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);
}


[-- Attachment #3: Type: text/plain, Size: 214 bytes --]

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

  reply	other threads:[~2002-01-26 19:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <008501c17af9$d044f4f0$8feb85ce@amr.corp.intel.com>
2001-12-02 10:24 ` Ralf Habacker
2001-12-02 12:05   ` Tim Prince
2001-12-02 13:58   ` Tim Prince
2001-12-04  7:19     ` Ralf Habacker
2001-12-04 16:44       ` Tim Prince
2001-12-04 21:27       ` Tim Prince
2001-12-05 12:56       ` Tim Prince
2002-01-23  0:10         ` Ralf Habacker
2002-01-26 11:29           ` Ralf Habacker [this message]
2002-01-26 15:54             ` Old Thread: cygwin Performance Christopher Faylor
2002-01-27  1:30               ` Ralf Habacker
2002-01-28  8:39   ` Old Thread: Cygwin Performance Ralf Habacker
2002-01-30  2:01     ` Ralf Habacker
2001-11-20 17:43 Piyush Kumar
2001-11-30  6:36 ` Piyush Kumar
2001-12-01  6:33 ` Tim Prince
2001-12-01 11:39   ` Ralf Habacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000501c1a69d$b830b280$b66607d5@BRAMSCHE' \
    --to=ralf.habacker@freenet.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).