Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Dec 2010 13:49:18 +0300
From:      Lev Serebryakov <lev@FreeBSD.org>
To:        freebsd-hackers@freebsd.org
Subject:   PANIC: thread_exit: Last thread exiting on its own.
Message-ID:  <1385259976.20101230134918@serebryakov.spb.ru>

next in thread | raw e-mail | index | archive | help
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 <lev@FreeBSD.org>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1385259976.20101230134918>