libthr dies with 'Illegal call from signal handler'
Mike Makonnen
mtm at identd.net
Fri May 16 06:37:13 PDT 2003
On Fri, 16 May 2003 12:44:18 +0900 (JST)
Munehiro Matsuda <haro at kgt.co.jp> wrote:
> Hi all,
>
> I'm trying out the latest libthr.so and occasionally get following error
> which kills application.
>
> Fatal error 'Illegal call from signal handler' at line 1352 in file
> /usr/src/lib/libthr/thread/thr_mutex.c (errno = 0)
This normally happens when a thread goes to queue on a mutex or cv (in your case
it's a mutex) and finds out it's already on one of the queue's. Normally, a
thread is suspended while on a queue, so the reasoning is that if it's hitting
this assertion it must be in a signal handler, but since libthr is not fully
locked yet this may not be the case.
>
> Now, what can I do to help debug this problem?
>
Well, it would be very helpful if you could recompile the application, libthr,
and libc with debuging symbols and post a backtrace. Also, the following patch
will print more information on the thread and which queue it's on.
Cheers.
--
Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm at identd.net | D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9
mtm at FreeBSD.Org| FreeBSD - The Power To Serve
Index: lib/libthr/thread/thr_mutex.c
===================================================================
RCS file: /home/ncvs/src/lib/libthr/thread/thr_mutex.c,v
retrieving revision 1.6
diff -u -r1.6 thr_mutex.c
--- lib/libthr/thread/thr_mutex.c 12 May 2003 10:48:02 -0000 1.6
+++ lib/libthr/thread/thr_mutex.c 16 May 2003 13:24:53 -0000
@@ -1347,8 +1347,16 @@
static inline void
mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread)
{
+ char *name;
pthread_t tid = TAILQ_LAST(&mutex->m_queue, mutex_head);
+ name = pthread->name ? pthread->name : "(null)";
+ if ((pthread->flags & PTHREAD_FLAGS_IN_CONDQ) != 0)
+ _thread_printf(2, "Thread (%s:%u) already on condq\n",
+ pthread->name, pthread->uniqueid);
+ if ((pthread->flags & PTHREAD_FLAGS_IN_MUTEXQ) != 0)
+ _thread_printf(2, "Thread (%s:%u) already on mutexq\n",
+ pthread->name, pthread->uniqueid);
PTHREAD_ASSERT_NOT_IN_SYNCQ(pthread);
/*
* For the common case of all threads having equal priority,
More information about the freebsd-threads
mailing list