From owner-freebsd-stable@FreeBSD.ORG Tue Aug 19 11:20:20 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 038E216A4BF for ; Tue, 19 Aug 2003 11:20:20 -0700 (PDT) Received: from diaspar.rdsnet.ro (diaspar.rdsnet.ro [81.196.201.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F2AD43FBF for ; Tue, 19 Aug 2003 11:20:12 -0700 (PDT) (envelope-from Vlad.Galu@rdsnet.ro) Received: (qmail 87170 invoked from network); 19 Aug 2003 18:18:44 -0000 Received: from unknown (HELO diaspar.rdsnet.ro) (81.196.201.65) by 0 with SMTP; 19 Aug 2003 18:18:44 -0000 Date: Tue, 19 Aug 2003 21:18:44 +0300 From: Vlad Galu To: freebsd-stable@freebsd.org In-Reply-To: References: Organization: Romania Data Systems X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20030819182012.3F2AD43FBF@mx1.FreeBSD.org> Subject: Re: kqueue freezing 5.1R on kevent call X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Aug 2003 18:20:20 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 19 Aug 2003 11:08:46 -0700 (PDT) "Krishna N. Ramachandran" wrote: > Hi, > The sample program given below freezes my 5.1R installation. This > program is from a bug report - kern/54331. That bug report > (http://lists.freebsd.org/pipermail/freebsd-bugs/2003-July/001608.html) is > for the shutdown function call, whereas my machine basically just freezes > up and reboots on kevent itself. I am also noticing this problem with > another program i wrote (but too long to include here). > > Here is my uname output > FreeBSD marvin 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Fri Aug 1 16:14:43 > GMT 2003 root@:/usr/obj/usr/src/sys/EC5 i386 > > thank you in advance, > Krishna > The program exits cleanly on my -STABLE system. But just for my curiosity, why didn't you call kevent() using "&events" instead of "events". The function prototype says that this argument should be a pointer to a kevent structure, right? Furthermore, you there have an array of 10 such structures. Why is that, as long as you're only using the first one ? > Sample Program: > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > > int > main( int argc, char **argv ) > { > int queue, sock, i; > struct sockaddr_in addr; > struct kevent events[ 10 ]; > struct timespec ktime; > > queue = kqueue(); > if( queue == -1 ) { > perror( "kqueue() failure" ); > exit( 1 ); > } > > sock = socket( AF_INET, SOCK_STREAM, 0 ); > /* NOTE: None of this bind() and listen() code is necessary for the > crash, > * I'm including it to show the crash in 'normal operation' > */ > memset( &addr, 0, sizeof( addr )); > addr.sin_family = AF_INET; > addr.sin_port = htons( 3456 ); > addr.sin_addr.s_addr = INADDR_ANY; > if( bind( sock, (struct sockaddr *) &addr, sizeof( addr )) < 0 ) { > perror( "bind" ); > exit( 1 ); > } > if( listen( sock, 32 ) < 0 ) { > perror( "listen" ); > exit( 1 ); > } > > /* Must add the socket to the kqueue for it to crash */ > events[ 0 ].ident = sock; > events[ 0 ].udata = 0; > events[ 0 ].filter = EVFILT_READ; > events[ 0 ].flags = EV_ADD; > > ktime.tv_sec = 1; > ktime.tv_nsec = 0; > > /* CRASHES HERE ITSELF */ > i = kevent( queue, events, 1, events, 10, &ktime ); > printf( "kevent() returned %d\n", i ); > > printf( "Closing socket\n" ); > > /* CRASH!!! Must be a shutdown() call, close() alone won't do it. */ > shutdown( sock, SHUT_RDWR ); > close( sock ); > > /* Cleanup if we survive */ > printf( "Closing queue\n" ); > close( queue ); > > return 0; > } > > > > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" > - -- Vlad Galu Network & Systems Administrator Romania Data Systems NOC in Bucharest Phone: +40 21 30 10 850 http://www.rdsnet.ro - --------------------------------------------------------------------------- Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such a case, you should destroy this message and kindly notify the sender by reply e-mail. - --------------------------------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/QmoEP5WtpVOrzpcRAobKAJ9hpuciABNu09PRSiouRpEnK3lHZACcCnrv D+dNYS9UyhaV0aln1HIpiow= =MAlu -----END PGP SIGNATURE-----