From owner-freebsd-current@freebsd.org Sat Mar 19 19:48:02 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA350AD67AE for ; Sat, 19 Mar 2016 19:48:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CA781DEB for ; Sat, 19 Mar 2016 19:48:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u2JJlvMB006791 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 19 Mar 2016 21:47:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u2JJlvMB006791 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u2JJlvq8006790; Sat, 19 Mar 2016 21:47:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 19 Mar 2016 21:47:57 +0200 From: Konstantin Belousov To: "Oleg V. Nauman" Cc: freebsd-current@freebsd.org Subject: Re: Fatal error 'mutex is on list' at line 139 in file /usr/src/lib/libthr/thread/thr_mutex.c (errno = 35) Message-ID: <20160319194757.GE1741@kib.kiev.ua> References: <5093647.qxI0C33PyG@asus.theweb.org.ua> <45576337.8zmzmA87YE@asus.theweb.org.ua> <20160319103256.GD1741@kib.kiev.ua> <5286161.5Mbx8epR8j@asus.theweb.org.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5286161.5Mbx8epR8j@asus.theweb.org.ua> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Mar 2016 19:48:02 -0000 On Sat, Mar 19, 2016 at 04:03:06PM +0200, Oleg V. Nauman wrote: > Core was generated by `akonadi_baloo_index'. > Program terminated with signal SIGABRT, Aborted. > #0 0x0000000805630d6a in thr_kill () from /lib/libc.so.7 > (gdb) bt > #0 0x0000000805630d6a in thr_kill () from /lib/libc.so.7 > #1 0x0000000805630d3b in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 > #2 0x0000000805630ca9 in abort () at /usr/src/lib/libc/stdlib/abort.c:65 > #3 0x00000008053564b4 in _thread_exit ( > fname=0x805357b70 "/usr/src/lib/libthr/thread/thr_mutex.c", lineno=139, > msg=0x805357b97 "mutex is on list") at > /usr/src/lib/libthr/thread/thr_exit.c:182 > #4 0x000000080534cddc in mutex_assert_not_owned (m=0x80064d000) > at /usr/src/lib/libthr/thread/thr_mutex.c:139 > #5 0x000000080534cfb9 in enqueue_mutex (curthread=0x80e015000, m=0x80064d000) > at /usr/src/lib/libthr/thread/thr_mutex.c:383 > #6 0x000000080534d213 in mutex_lock_common (m=0x80064d000, > abstime=0x7fffffffd4e8, > cvattach=0) at /usr/src/lib/libthr/thread/thr_mutex.c:533 > #7 0x000000080534c6be in __pthread_mutex_timedlock (mutex=0x811c00008, > abstime=0x7fffffffd4e8) at /usr/src/lib/libthr/thread/thr_mutex.c:566 > > (gdb) f 7 > #7 0x000000080534c6be in __pthread_mutex_timedlock (mutex=0x811c00008, > abstime=0x7fffffffd4e8) at /usr/src/lib/libthr/thread/thr_mutex.c:566 > 566 ret = mutex_lock_common(m, abstime, 0); > (gdb) p *mutex > $1 = (pthread_mutex_t) 0x8000000000000001 > (gdb) p m > $2 = (struct pthread_mutex *) 0x80064d000 > (gdb) p *m > $3 = {m_lock = {m_owner = -2147383372, m_flags = 1, m_ceilings = {0, 0}, > m_spare = {0, 0, 0, > 0}}, m_flags = 1, m_owner = 100276, m_count = 0, m_spinloops = 0, > m_yieldloops = 0, > m_qe = {tqe_next = 0x0, tqe_prev = 0x0}, m_pqe = {tqe_next = 0x0, tqe_prev = > 0x0}} > (gdb) p *curthread > No symbol "curthread" in current context. > (gdb) curthread is available e.q. in the frame 5. The content from the printout is reasonable, but now it contradicts to the assertion fired, since both checked pointers are NULL, as reported by gdb. Please add the following debugging patch on top of the previous change and reproduce the issue. I need the same info, but please also provide exact gasp message from libthr, which is enchanced in the patch below. diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 30a8be2..3342c9f 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -124,8 +124,14 @@ mutex_assert_is_owned(struct pthread_mutex *m) { #if defined(_PTHREADS_INVARIANTS) - if (__predict_false(m->m_qe.tqe_prev == NULL)) - PANIC("mutex is not on list"); + if (__predict_false(m->m_qe.tqe_prev == NULL)) { + char msg[128]; + snprintf(msg, sizeof(msg), + "mutex %p own %#x %#x is not on list %p %p", + m, m->m_lock.m_owner, m->m_owner, m->m_qe.tqe_prev, + m->m_qe.tqe_next); + PANIC(msg); + } #endif } @@ -135,8 +141,14 @@ mutex_assert_not_owned(struct pthread_mutex *m) #if defined(_PTHREADS_INVARIANTS) if (__predict_false(m->m_qe.tqe_prev != NULL || - m->m_qe.tqe_next != NULL)) - PANIC("mutex is on list"); + m->m_qe.tqe_next != NULL)) { + char msg[128]; + snprintf(msg, sizeof(msg), + "mutex %p own %#x %#x is on list %p %p", + m, m->m_lock.m_owner, m->m_owner, m->m_qe.tqe_prev, + m->m_qe.tqe_next); + PANIC(msg); + } #endif }