From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 30 11:06:52 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999BA106566B for ; Thu, 30 Dec 2010 11:06:52 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from ftp.translate.ru (ftp.translate.ru [80.249.188.42]) by mx1.freebsd.org (Postfix) with ESMTP id 282788FC17 for ; Thu, 30 Dec 2010 11:06:52 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (89.112.15.178.pppoe.eltel.net [89.112.15.178]) (Authenticated sender: lev@serebryakov.spb.ru) by ftp.translate.ru (Postfix) with ESMTPA id 67ECD13DF61 for ; Thu, 30 Dec 2010 13:49:23 +0300 (MSK) Date: Thu, 30 Dec 2010 13:49:18 +0300 From: Lev Serebryakov Organization: FreeBSD X-Priority: 3 (Normal) Message-ID: <1385259976.20101230134918@serebryakov.spb.ru> To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable Subject: PANIC: thread_exit: Last thread exiting on its own. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: lev@FreeBSD.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2010 11:06:52 -0000 Hello, Hackers. I've got this panic on reboot from geom_raid5. This module has two threads, each of them finished with kthread_exit(). But it doesn't panic on every reboot (really, it is first time I got it in row of many reboots with this module running), so it seems to be some race, am I right? I've read code of thread_exit() and I'm not sure I understand it well. It seems, that EVERY termination of last thread in process should provoke this panic: if (p->p_flag & P_HADTHREADS) { if (p->p_numthreads > 1) { ... } else { /* * The last thread is exiting.. but not through exit() */ panic ("thread_exit: Last thread exiting on its own"); } } But kthread_exit() has special processing of this situation: if (curthread->td_proc->p_numthreads =3D=3D 1) kproc_exit(0); /* never returns */ So, it seems to be some strange race condition in FreeBSD 8-STABLE. P.S. is this list appropriate for such questions? As far as I understand, "stable" list is more user-related, not developer-related, and it is not exactly question about CURRENT. --=20 // Black Lion AKA Lev Serebryakov