From owner-freebsd-hackers Wed Jan 26 20:57:36 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id B055D154E5 for ; Wed, 26 Jan 2000 20:57:30 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id UAA18887; Wed, 26 Jan 2000 20:57:29 -0800 (PST) (envelope-from dillon) Date: Wed, 26 Jan 2000 20:57:29 -0800 (PST) From: Matthew Dillon Message-Id: <200001270457.UAA18887@apollo.backplane.com> To: "Scott Hess" Cc: Subject: Re: aio_read crashing certain kernels. References: <01b301bf6824$46e928a0$1e80000a@avantgo.com> <200001262330.PAA16635@apollo.backplane.com> <066e01bf6877$02deb550$1e80000a@avantgo.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :The simplest program imaginable causes the problem (see included file for :an example). Another item came to mind - SMP. The boxes with the crashes :are SMP, the box without the crashes is not. Since rfork(RFMEM) doesn't :work with SMP, and aio_read seems to be implemented by sharing memory with :an aiod process, perhaps it's the same issue? [If so, perhaps it needs to :be returning an ENOTSUPP from aio_read :-).] : :void main( void) :{ : int fd=open( "/tmp/myfile", O_RDONLY); : char buf[ 1024]; : struct aiocb iocb; : iocb.aio_fildes=fd; : iocb.aio_offset=0; : iocb.aio_buf=buf; : iocb.aio_nbytes=sizeof( buf); : iocb.aio_sigevent.sigev_notify=SIGEV_SIGNAL; : iocb.aio_sigevent.sigev_signo=SIGIO; : aio_read( &iocb); :} : :Thanks, :scott This is an incredibly scary program! It's sending an iocb to aio_read and then pops the stack and exits. The act of exiting could very well scribble all over the iocb structure while the I/O is in progress and, of course, then the program invalidates the stack and exits. I haven't been able to reproduce the crash on my 3.4 test box yet, I've tried both SMP and non-SMP builds (it's a duel-cpu box). I would like you to make some modifications to your program ... please bzero() the iocb structure before you initialize it, and see if the problem still occurs. If it does, then try putting a sleep(5) after the aio_read() and see if the problem still occurs. You could be right about the SMP build --- the aio code is indeed doing a fork with RFMEM and that *WILL* break under SMP. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message