PANIC: thread_exit: Last thread exiting on its own.

Lev Serebryakov lev at FreeBSD.org
Thu Dec 30 11:06:52 UTC 2010


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 == 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.

-- 
// Black Lion AKA Lev Serebryakov <lev at FreeBSD.org>



More information about the freebsd-hackers mailing list